Is there any limit to use inJustDecodeBounds? When my picture is
small enough, it works well, but it will report "failed binder
transaction" in logcat when the picture size is larger than 100k. I
have not use any binder, and it works well even the bitmap size is 1M
before using Options argument.
Here's my code:
Options opts = new Options();
opts.inJustDecodeBounds = true;
BitmapFactory.decodeFile(path, opts);
Log.e("optwidth",opts.outWidth+"");
opts.inJustDecodeBounds = false;
if(opts.outWidth>500){
opts.inSampleSize = 4;
mBitmap = BitmapFactory.decodeFile(path, opts);
}
else mBitmap = BitmapFactory.decodeFile(path, opts);
On Jun 4, 10:08 pm, Streets Of Boston <[email protected]> wrote:
> Set the Options.inJustDecodeBounds to true and call the
> BitmapFactory's method to get/decode your bitmap. The bitmap returned
> will be null, but the Options.outWidth and Options.outHeight will be
> set to the image's width and height in pixels.
>
> Then call the BitmapFactory's method to get/decode your bitmap again,
> with Options.inJustDecodeBounds set to false and its inSampleSize set
> to your liking.
>
> BTW: This is all in the
> documentation:http://developer.android.com/reference/android/graphics/BitmapFactory...
>
> On Jun 4, 4:37 am, quill <[email protected]> wrote:
>
>
>
> > Hi all,
> > I want to know an image's width before decode it, so that I can set
> > Options.inSampleSize if the image is too large. Any advice to do that?-
> > Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---