android - Efficient way of creating Bitmap out of Drawable from res (BitmapFactory vs Type Casting) -
which method more efficient creating bitmap out of drawable resources?
bitmap mybitmap = bitmapfactory.decoderesource(context.getresources(), r.drawable.icon_resource);
vs
drawable mydrawable = getresources().getdrawable(r.drawable.icon_resource); bitmap mybitmap = ((bitmapdrawable) mydrawable).getbitmap();
you can take @ source code bitmap mill @ http://source.android.com code decoderesource.
i reason using bitmapfactory preferred in either case if decoding multiple bitmaps should phone call getresources() 1 time , store result utilize resources argument functions.
android bitmap android-resources bitmapfactory android-drawable
No comments:
Post a Comment