Scale the image. 2048 * 1536 * 2 (16 bit color) = 6MByte.
This is too large for most android processes. You can usually load one of these big ones, loading two becomes problematic, 3 of them is usually not possible. The best thing to do is to avoid loading one big one at all. Your image-view is not 2048x1536 pixels big. Use the BitmapFactory 'decode' methods to load a smaller version of your image, that closely matches your size of your image-view. Use the BitmapFactory.Options and set the inSampleSize to a value larger than 1. E.g. if you set this to 2, and set inPreferredConfig to RGB_565, then your bitmap will be 2048/2 x 1536/2 * 2 = 1.5MByte. If you set this to 4, your bitmap will be 2048/4 * 1536/4 * 2 = 384KByte On Jun 1, 11:52 pm, Rockingteam <[email protected]> wrote: > Any help on this??? > Even i am facing the same problem. > > On Apr 23, 5:04 pm, zeeshan <[email protected]> wrote: > > > > > Hi Experts, > > > i captured an image by android G1, now trying to display it as > > ImageView but it gives me memory allocation exception. > > > Uri image= Uri.parse(imageFile); > > imageicon.setImageURI(image); > > > ///////////////// > > > <ImageView > > android:id="@+id/imageicon" > > > android:adjustViewBounds="true" > > android:maxWidth="291dip" > > android:maxHeight="55dip" > > android:layout_width="wrap_content" > > android:layout_height="wrap_content" > > android:layout_gravity="center" > > android:paddingTop="10dip" > > /> > > > the default image resolution of G1 camera is 2048 * 1536 > > > i also tried to compress image on selection but still same exception. > > //////////////////////////// > > onActivityResult > > ////////////////////////// > > > OutputStream outstream; > > Bitmap bitmap = Media.getBitmap(getContentResolver(), selectedImage); > > > outstream = getContentResolver().openOutputStream(Uri.parse > > (imageFile)); > > > > bitmap.compress(Bitmap.CompressFormat.JPEG, 70, > > outstream); > > outstream.close(); > > > any solution please?- 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 -~----------~----~----~----~------~----~------~--~---

