2012-02-17 13 views
1

ギャラリーのような別のアプリで画像を開くにはどうすればよいですか?Androidインテント画像

このように意図する必要がありますか?

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

可能重複(http://stackoverflow.com/questions/2169649 /オープン画像インアンドロイド内蔵型ギャラリー-APP-プログラム) – MByD

+0

チェックアウト[本] [1] [1]:http://stackoverflow.com/questions/ 2169649/open-an-image-in-inside-gallery-app-programmatically –

+0

チェクアウト[this] [1] [1]:http://stackoverflow.com/questions/2169649/open-an-image-in-androids-built-in-gallery-app-programmatically –

答えて

2

これは、画像/ pngを表示するためのAndroidのインテントを作成します。

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

ファイルがプライベートサンドボックスではなくすべてのユーザーに表示されていることを確認してください。それをデータフォルダのsdcardに保存するのは一般的です。 /sdcard/data/appname/filename.png

0

使用[Androidの組み込みのギャラリーアプリで画像を開いて、プログラム]のこの

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