就算第一次只是拿去用 inJustDecodeBounds 也一樣。
每次要使用前都要做 is.reset();
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BitmapFactory.Options opts = new BitmapFactory.Options(); | |
opts.inJustDecodeBounds = true; | |
BitmapFactory.decodeStream(is, null, opts); | |
... | |
opts.inSampleSize = ... | |
opts.inJustDecodeBounds = false; | |
... | |
is.reset(); //XXX Android 4.4 KitKat, Important! Without this, bmp will return null. | |
Bitmap bmp = BitmapFactory.decodeStream(is, null, opts); |
沒有留言:
張貼留言