ビットマップを効果的にロードするためにandroidのBitmapfunアプリケーションを使用しています.しかし、時々BitmapFactory.decodeFileDescriptor()でクラッシュが発生します. ログの cat と関数を以下に示します。return ステートメントでクラッシュが発生します。助けてください。よろしくお願いします。
public static Bitmap decodeSampledBitmapFromDescriptor(
FileDescriptor fileDescriptor, int reqWidth, int reqHeight, ImageCache cache) {
// First decode with inJustDecodeBounds=true to check dimensions
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFileDescriptor(fileDescriptor, null, options);
// Calculate inSampleSize
options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);
// Decode bitmap with inSampleSize set
options.inJustDecodeBounds = false;
// If we're running on Honeycomb or newer, try to use inBitmap
if (Utils.hasHoneycomb()) {
addInBitmapOptions(options, cache);
}
return BitmapFactory.decodeFileDescriptor(fileDescriptor, null, options);
}
ログキャット
06-25 14:20:56.055: E/AndroidRuntime(5978): FATAL EXCEPTION: AsyncTask #3
06-25 14:20:56.055: E/AndroidRuntime(5978): java.lang.RuntimeException: An error occured while executing doInBackground()
06-25 14:20:56.055: E/AndroidRuntime(5978): at com.vbk.vobok.util.AsyncTask$3.done(AsyncTask.java:325)
06-25 14:20:56.055: E/AndroidRuntime(5978): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
06-25 14:20:56.055: E/AndroidRuntime(5978): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
06-25 14:20:56.055: E/AndroidRuntime(5978): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
06-25 14:20:56.055: E/AndroidRuntime(5978): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
06-25 14:20:56.055: E/AndroidRuntime(5978): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
06-25 14:20:56.055: E/AndroidRuntime(5978): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
06-25 14:20:56.055: E/AndroidRuntime(5978): at java.lang.Thread.run(Thread.java:856)
06-25 14:20:56.055: E/AndroidRuntime(5978): Caused by: java.lang.IllegalArgumentException: Problem decoding into existing bitmap
06-25 14:20:56.055: E/AndroidRuntime(5978): at android.graphics.BitmapFactory.decodeFileDescriptor(BitmapFactory.java:664)
06-25 14:20:56.055: E/AndroidRuntime(5978): at com.vbk.vobok.util.ImageResizer.decodeSampledBitmapFromDescriptor(ImageResizer.java:196)
06-25 14:20:56.055: E/AndroidRuntime(5978): at com.vbk.vobok.util.ImageFetcher.processBitmap(ImageFetcher.java:242)
06-25 14:20:56.055: E/AndroidRuntime(5978): at com.vbk.vobok.util.ImageFetcher.processBitmap(ImageFetcher.java:255)
06-25 14:20:56.055: E/AndroidRuntime(5978): at com.vbk.vobok.util.ImageWorker$BitmapWorkerTask.doInBackground(ImageWorker.java:326)
06-25 14:20:56.055: E/AndroidRuntime(5978): at com.vbk.vobok.util.ImageWorker$BitmapWorkerTask.doInBackground(ImageWorker.java:1)
06-25 14:20:56.055: E/AndroidRuntime(5978): at com.vbk.vobok.util.AsyncTask$2.call(AsyncTask.java:313)
06-25 14:20:56.055: E/AndroidRuntime(5978): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
06-25 14:20:56.055: E/AndroidRuntime(5978): ... 4 more