views:

902

answers:

2

hi friends... i am working on displaying an image and placing an icon on top of it... clicking the icon will show an enlarged version of the image...

though putting the imageview holding the image in a LinearLayout scales the image to the width of the dialog, the problem is that i need to display the image in a dialog but the image is very high resolution and hence is far bigger than the width of the dialog...

I need to show the actual image with scrolling for both ways to see the whole image... But whenever i try putting the imageView in a scrollview the top of my imageview is blank... and again though image scrolls downwards the width is scaled to the width of the dialog...

Helppppppppp guys....

+1  A: 

developer.android.com/reference/android/graphics/Bitmap.html

developer.android.com/reference/android/graphics/BitmapFactory.html

refer this link.

Bitmap mIcon1 = BitmapFactory.decodeResource(context.getResources(),R.drawable.twitter_icon);
imgview.setImageBitmap(mIcon1);

convert your image to bitmap and use. hope it works.....

EDIT:

URL img_value = new URL(string_url_input);
if (profile != null) {
    Bitmap mIcon1 = BitmapFactory.decodeStream(img_value.openConnection().getInputStream());
    image_view.setImageBitmap(mIcon1);
}
Praveen Chandrasekaran
Thanx a lot androidbase... the problem i face is that the image comes from the internet and in that case i tried directly converting the downloaded image into bitmap using InputStream is = (InputStream)url.getContent(); Bitmap d = BitmapFactory.decodeStream(is);but it still didnt work out... don know if the Dialog cant display larger images???
JaVadid
hi vadid hw r you ?
yakub_moriss
refer my edit it works. the problem is you have to establish a connection first.
Praveen Chandrasekaran
+1  A: 

Thanx for your help androidbase... I found the solution... Actually we can say its a workaround but better than any other solution i can think of...

Actually what i do is that i implement webview and directly load the image url in it using webview.loadurl(myurl);

and further i enabled the zoom featured too hence i get an allround complete zooming capabilities...

Thanx all 4 ur help

JaVadid