1

サイトhttp://218.93.33.59:85/map/zjmap/ibikegif.asp?flag=2&id=9では、ibikegif.gif という名前の gif 画像を取得できます。ただし、Androidフォンでは表示できません。私のコードは次のようになります:

/**
    *@param url the imageURL.it references to 
    *"http://218.93.33.59:85/map/zjmap/ibikegif.asp?flag=2&id=9" here
    *
    **/
    public Bitmap returnBitMap(String url) {
        URL myFileUrl = null;
        Bitmap bitmap = null;
        try {
            myFileUrl = new URL(url);
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
        try {
            HttpURLConnection conn = (HttpURLConnection) myFileUrl
                    .openConnection();
            conn.setDoInput(true);
            conn.connect();
            InputStream is = conn.getInputStream();
            bitmap = BitmapFactory.decodeStream(is); //Attention:bitmap is null     
            is.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return bitmap;
    }

私たちを手伝ってくれますか?

4

1 に答える 1