I want to show the Bitmap image in ImageView from sd card which is stored already. After run my application is crash and getting Ou
OutOfMemoryError is the most common problem occured in android while especially dealing with bitmaps. This error is thrown by the Java Virtual Machine (JVM) when an object cannot be allocated due to lack of memory space and also, the garbage collector cannot free some space.
As mentioned by Aleksey, you can add below entities in your manifest file android:hardwareAccelerated="false"
, android:largeHeap="true"
it will work for some environment's.
you should definately read some of Androids Developer concept's, specially here:Displaying Bitmaps Efficiently
Read all 5 topics and rewrite your code again. If it still doesn't work we will be happy to see what you've done wrong with the tutorial material.
Here some of possible answers for these type of errors in SOF
Android: BitmapFactory.decodeStream() out of memory with a 400KB file with 2MB free heap
How to solve java.lang.OutOfMemoryError trouble in Android
Android : java.lang.OutOfMemoryError
java.lang.OutOfMemoryError
Solution for OutOfMemoryError: bitmap size exceeds VM budget
Edit: From the comments of @cjnash
For anyone that still had crashes after they added this line, try sticking your image into your res/drawable-xhdpi/ folder instead of your res/drawable/ and it might resolve your issue.