I am having image large size image, at run time i want read image from storage and scale it so that its weight and size will be reduce and i can use it as thumbnail when user click on thumbnail i will display full size image.
A:
Use BitmapFactory.decodeFile(...) to get your Bitmap object and set it to an ImageView with ImageView.setImageBitmap().
On the ImageView set the layout dimensions to something small, eg:
android:layout_width="66dip" android:layout_height="48dip"
Add an onClickListener to the ImageView and launch a new activity, where you display the image in full size with
android:layout_width="wrap_content" android:layout_height="wrap_content"
or specify some larger size.
Jim Blackler
2010-04-05 06:51:39
When having multiple images you should consider scaling it down to the thumb size beforehand. otherwise that could slow down the performance when moving the set.
Soulreaper
2010-04-05 07:17:59
Indeed, and to do that you would use Bitmap.createScaledBitmap(originalBitmap, newWidth, newHeight, false);
Jim Blackler
2010-04-05 08:34:19
dones following method also reduce the weight of the image ? Bitmap.createScaledBitmap(originalBitmap, newWidth, newHeight, false)
Faisal khan
2010-04-06 11:05:45