1,780 questions
1393 votes
44 answers
654k views
Strange OutOfMemory issue while loading an image to a Bitmap object
I have a ListView with a couple of image buttons on each row. When the user clicks the list row, it launches a new activity. I have had to build my own tabs because of an issue with the camera layout. ...
447 votes
32 answers
590k views
Android:java.lang.OutOfMemoryError: Failed to allocate a 23970828 byte allocation with 2097152 free bytes and 2MB until OOM
I want to show the Bitmap image in ImageView from sd card which is stored already. After run my application is crash and getting OutOfMemoryError error of: (java.lang.OutOfMemoryError: Failed to ...
323 votes
7 answers
233k views
Get Bitmap attached to ImageView
Given ImageView image = R.findViewById(R.id.imageView); image.setImageBitmap(someBitmap); Is it possible to retrieve the bitmap?
272 votes
24 answers
482k views
How to get Bitmap from an Uri?
How to get a Bitmap object from an Uri (if I succeed to store it in /data/data/MYFOLDER/myimage.png or file///data/data/MYFOLDER/myimage.png) to use it in my application? Does anyone have an idea on ...
198 votes
8 answers
319k views
Saving and Reading Bitmaps/Images from Internal memory in Android
What I want to do, is to save an image to the internal memory of the phone (Not The SD Card). How can I do it? I have got the image directly from the camera to the image view in my app its all ...
175 votes
7 answers
166k views
Android Bitmap to Base64 String
How do I convert a large Bitmap (photo taken with the phone's camera) to a Base64 String?
160 votes
18 answers
116k views
"Bitmap too large to be uploaded into a texture"
I'm loading a bitmap into an ImageView, and seeing this error. I gather this limit relates to a size limit for OpenGL hardware textures (2048x2048). The image I need to load is a pinch-zoom image of ...
89 votes
4 answers
65k views
What is the difference between Bitmap and Drawable in Android?
I googled but i couldn't find any article to describe about the difference between Bitmap and Drawable in Android.
74 votes
9 answers
100k views
Scale image keeping its aspect ratio in background drawable
How do I make a background image fit the view but keep its aspect ratio when using <bitmap /> as a background drawable XML? None of <bitmap>'s android:gravity values gives the desired ...
65 votes
8 answers
42k views
How to use RoundedBitmapDrawable
Has anyone managed to use RoundedBitmapDrawable? Correct me if I'm wrong, but to my understanding, it makes a circular image from a regular rectangular image. What I've tried so far is this ...
65 votes
6 answers
55k views
Drawable to byte[]
I have an image from the web in an ImageView. It is very small (a favicon) and I'd like to store it in my SQLite database. I can get a Drawable from mImageView.getDrawable() but then I don't know what ...
65 votes
5 answers
66k views
Android- how can I convert android.net.Uri object to java.net.URI object?
I am trying to get a FileInputStream object on an image that the user selects from the picture gallery. This is the android URI returned by android.provider.MediaStore.Images.Media....
45 votes
6 answers
62k views
android get Bitmap or sound from assets
I need to get Bitmap and sound from assets. I try to do like this: BitmapFactory.decodeFile("file:///android_asset/Files/Numbers/l1.png"); And like this: getBitmapFromAsset("Files/Numbers/l1.png"); ...
42 votes
5 answers
76k views
Android - ImageView: setImageBitmap VS setImageDrawable
What is the difference between setImageBitmap and setImageDrawable? I have an image which I would like to set dynamically from file. The tutorial that I followed says to convert my Bitmap to a ...
42 votes
6 answers
30k views
Flip a Bitmap image horizontally or vertically
By using this code we can rotate an image: public static Bitmap RotateBitmap(Bitmap source, float angle) { Matrix matrix = new Matrix(); matrix.postRotate(angle); return Bitmap....