android - Display big image in ImageView -
if choose big picture such it is gallery , try display in imageview, imageview not display it.
public class colorvieweractivity extends activity { // skip other methods private static final int select_photo_request = 100; @override public boolean onoptionsitemselected(menuitem item) { switch (item.getitemid()) { case r.id.open_image: selectimage(); break; } return true; } private void selectimage() { intent photopickerintent = new intent(intent.action_pick); photopickerintent.settype("image/*"); startactivityforresult(photopickerintent, select_photo_request); } @override protected void onactivityresult(int requestcode, int resultcode, intent imagereturnedintent) { super.onactivityresult(requestcode, resultcode, imagereturnedintent); switch(requestcode) { case select_photo_request: if (resultcode == result_ok) { uri imageuri = imagereturnedintent.getdata(); imageview imageview = (imageview) findviewbyid(r.id.imageview); imageview.setimageuri(imageuri); } } } }
why?? because image big?
sorry english.
thanks
if use huge image exceeds memory throw
java.lang.outofmemoryerror: bitmap size exceeds vm budget.
to know how display bitmaps efficiently check this link
Comments
Post a Comment