All Questions

409
votes
36answers
281971 views

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?
779
votes
30answers
421785 views

findViewById in Fragment

I am trying to create an ImageView in a Fragment which will refer to the ImageView element which I have created in the XML for the Fragment. However, the findViewById method only works if I extend an ...
238
votes
1answers
267541 views

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(),...
408
votes
21answers
461922 views

How to scale an Image in ImageView to keep the aspect ratio

In Android, I defined an ImageView's layout_width to be fill_parent (which takes up the full width of the phone). If the image I put to ImageView is bigger than the layout_width, Android will scale i...
77
votes
9answers
171493 views

How to download and save an image in Android

How do you download and save an image from a given url in Android?
223
votes
12answers
329077 views

Show Image View from file path?

I need to show an image by using the file name only, not from the resource id. ImageView imgView = new ImageView(this); imgView.setBackgroundResource(R.drawable.img1); I have the image img1 in the ...
87
votes
7answers
74737 views

Android Camera : data intent returns null

I have an android application which contains multiple activities. In one of them I'm using a button which will call the device camera : public void onClick(View view) { Intent photoIntent = new...
0
votes
2answers
32224 views

Passing image from one activity another activity

There are similar questions on SO, but none worked for me. I want to fetch clicked image in Activity1 and display it in Activity2.I'm fetching image id of clicked image like this: ((ImageView) v).ge...
4
votes
2answers
11231 views

How to maintain multi layers of ImageViews and keep their aspect ratio based on the largest one?

Suppose I have multiple Images that I need to put one on top of the other, some might have some kind of animation appearing and some might even be draggable. the largest one which usually takes the w...
127
votes
17answers
90540 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 a...

Previous Next