Questions tagged [android-image]

This tag is for questions related to images on Android

1540 questions
704
votes
58 answers

How to make an ImageView with rounded corners?

In Android, an ImageView is a rectangle by default. How can I make it a rounded rectangle (clip off all 4 corners of my Bitmap to be rounded rectangles) in the ImageView? Note that from 2021 onwards, simply use ShapeableImageView
michael
  • 106,540
  • 116
  • 246
  • 346
348
votes
10 answers

How to pick an image from gallery (SD Card) for my app?

This question was originally asked for Android 1.6. I am working on photos options in my app. I have a button and an ImageView in my Activity. When I click the button it would redirect to the gallery and I would be able to select an image. The…
Praveen
  • 90,477
  • 74
  • 177
  • 219
308
votes
18 answers

How to clear an ImageView in Android?

I am reusing ImageViews for my displays, but at some point I don't have values to put it. So how to clear an ImageView in Android? I've tried: mPhotoView.invalidate(); mPhotoView.setImageBitmap(null); None of them have cleared the view, it still…
Pentium10
  • 204,586
  • 122
  • 423
  • 502
268
votes
24 answers

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 how to accomplish this?
ilredelweb
  • 3,091
  • 4
  • 17
  • 14
256
votes
1 answer

How to create a circular ImageView in Android?

How could I create a rounded ImageView in Android? I have tried the following code, but it's not working fine. Code: Bitmap circleBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888); BitmapShader shader =…
user2134412
196
votes
8 answers

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 working fine. Now what I want is to save this image from…
usamazf
  • 3,195
  • 4
  • 22
  • 40
159
votes
18 answers

"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 about 4,000 pixels high. I've tried turning off…
Ollie C
  • 28,313
  • 34
  • 134
  • 217
135
votes
5 answers

How do I get the resource id of an image if I know its name?

How do I get the resource id of an image if I know its name (in Android)?
manu
  • 1,476
  • 2
  • 10
  • 6
110
votes
4 answers

Reading an image file into bitmap from sdcard, why am I getting a NullPointerException?

How can I read an image file into bitmap from sdcard? _path = Environment.getExternalStorageDirectory().getAbsolutePath(); System.out.println("pathhhhhhhhhhhhhhhhhhhh1111111112222222 " + _path); _path= _path + "/" + "flower2.jpg"; …
Smitha
  • 6,110
  • 24
  • 90
  • 161
100
votes
9 answers

Android Text over image

I have an imageView with an image, over that image I want to place a text. How can I achieve that?
AndyAndroid
  • 4,039
  • 14
  • 44
  • 71
97
votes
14 answers

Open an image using URI in Android's default gallery image viewer

I have extracted image uri, now I would like to open image with Android's default image viewer. Or even better, user could choose what program to use to open the image. Something like File Explorers offer you if you try to open a file.
Badr Hari
  • 8,114
  • 18
  • 67
  • 100
88
votes
4 answers

About Android image and asset sizes

I need to clarify some doubt about the image assets for my app, if I specify in an xml file that the height of something [image view] is 50 dip height which type of screen should i choose from the resources folder? drawable, hdpi, ldpi, mdpi,…
69
votes
8 answers

How to display a list of images in a ListView in Android?

How do I display a list of images using the ListView? I am downloading the images at run time. The total number of images is not fixed.
Komal
45
votes
3 answers

Access pictures from Pictures app in my android app

Just like the iPhone has a UIImagePickerController to let the user access pictures stored on the device, do we have a similar control in the Android SDK? Thanks.
lostInTransit
  • 70,519
  • 61
  • 198
  • 274
43
votes
16 answers

Remove the SearchIcon as hint in the searchView

I am doing an application where for example when i click on the image(it is a searchView) the search pad opens ! and it looks like but here the default search icon (magnifier) gets displayed but this dissappears as soon as some text is…
Hummer
  • 811
  • 1
  • 6
  • 14
1
2 3
99 100