Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open default Image Viewer

Tags:

android

image

I have displayed a set of images in the list view, when I click one list item image, that specific image have to open in the default Image Viewer.

When the click is made i taken that specific image and displayed in the imageview but for addition facilities like zoom all i have to open that Bitmap image in the default Image Viewer in android.

Can any one tell me possible answer. Thank you in advance.

like image 852
Vanitha Avatar asked Jan 02 '26 03:01

Vanitha


2 Answers

In listview on itemclick u just add this .

            File file = new File(itemList.get(position));
            Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
            Uri data = Uri.parse("file://" + file.getAbsolutePath());
            intent.setDataAndType(data, "image/*");
            startActivity(intent);

in itemlist is your arraylist.

like image 90
Kishan patel Avatar answered Jan 03 '26 15:01

Kishan patel


By using this you can open default Image Viewer

Intent viewImageIntent = new Intent(android.content.Intent.ACTION_VIEW, uri);
startActivity(viewImageIntent);
like image 25
Keyur Lakhani Avatar answered Jan 03 '26 17:01

Keyur Lakhani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!