android bug n°6066 में प्रदान किया गया समाधान std FilterInputStream को ओवरराइड करने में शामिल है और फिर इसे बिटमैप फैक्टरी में भेजता है।
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 byteValue = read();
if (byteValue < 0) {
break; // we reached EOF
} else {
bytesSkipped = 1; // we read one byte
}
}
totalBytesSkipped += bytesSkipped;
}
return totalBytesSkipped;
}
}
और फिर decodeStream समारोह का उपयोग करें:
Bitmap bitmap = BitmapFactory.decodeStream(new FlushedInputStream(inputStream));
अन्य समाधान मैं पाया है BitmapFactory बस एक BufferedInputStream th करने के लिए दे रहा है:
Bitmap bitmap = BitmapFactory.decodeStream(new BufferedInputStream(inputStream));
इन दो समाधान चाल करना चाहिए।
अधिक जानकारी बग रिपोर्ट टिप्पणी में पाया जा सकता है: android bug no.6066
स्रोत
2011-03-22 18:19:28
क्या आप इस छवि को प्रदर्शित करने वाली छवि को लिंक प्रदान कर सकते हैं? – CommonsWare
दुर्भाग्य से, मैं नहीं कर सकता। मैं समझता हूं कि आप अप्रत्यक्ष रूप से यहां क्यों संकेत कर रहे हैं ... :) – Samuh