1

画像の URL の場所から jpg ファイルをデコードするのに苦労しています。多くの異なるソリューションで試しましたが、これをデコードできませんでした。

以下の URL を試してみて、解決策を教えてください。

URL: http://halosys.co.in/FTP-LOCATION/ftp-user15/testing2.jpg

InputStream in = new java.net.URL(imageURL).openStream();
Bitmap bImage = BitmapFactory.decodeStream(new FlushedInputStream(in));
imageView.setImageBitmap(bImage);

static class FlushedInputStream extends FilterInputStream {
        public FlushedInputStream(InputStream inputStream) {
            super(inputStream);
        }

        @Override
        public long skip(long n) throws IOException {
            long totalBytesSkipped = 0L;
            while (totalBytesSkipped < n) {
                long bytesSkipped = in.skip(n - totalBytesSkipped);
                if (bytesSkipped == 0L) {
                    int b = read();
                    if (b < 0) {
                        break;  // we reached EOF
                    } else {
                        bytesSkipped = 1; // we read one byte
                    }
                }
                totalBytesSkipped += bytesSkipped;
            }
            return totalBytesSkipped;
        }
    }

また、この画像は iPhone アプリケーションによって正常にデコードされました。Android で画像をデコードする際に制限はありますか?

ありがとう

4

1 に答える 1

-1

画像に問題があります。その画像はskiaグラフィックスが有効になっているため、この問題に直面しています。

于 2013-07-22T12:17:19.170 に答える