Vanitha
Vanitha

Reputation: 153

Open default Image Viewer

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.

Upvotes: 3

Views: 6074

Answers (3)

Kishan patel
Kishan patel

Reputation: 214

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.

Upvotes: 6

Ahmad Aghazadeh
Ahmad Aghazadeh

Reputation: 17131

You can save bitmap to file and show image this code :

Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("file://" + filepath), "image/*");
startActivity(intent);

Upvotes: 1

Keyur Lakhani
Keyur Lakhani

Reputation: 4381

By using this you can open default Image Viewer

Intent viewImageIntent = new Intent(android.content.Intent.ACTION_VIEW, uri);
startActivity(viewImageIntent);

Upvotes: 2

Related Questions