Alexander Fuchs
Alexander Fuchs

Reputation: 1358

Android intent image

How can I open a image with another app like the gallery ?

so which intent do I have to call ?

Intent in=new Intent("intent?");
         startActivity(in);

Upvotes: 1

Views: 4735

Answers (2)

DineshKumar
DineshKumar

Reputation: 1689

use this

       intent.setData(android.Provider.MediaStore.Images.Media.Data);

Upvotes: 0

knaak
knaak

Reputation: 1313

This will create an Intent for Android to show a image/png.

Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(path)), "image/png");
startActivity(intent);

Just make sure the file is in a place visible to all, not in your private sandbox. Saving it to sdcard in the data folder is common eg. /sdcard/data/appname/filename.png

Upvotes: 2

Related Questions