简体   繁体   中英

Open image from drawable into gallery intent

I would like to open just one image and have pitch-zoom function, so (as I think) easiest way to do that is to open that image in gallery intent. Anybody can share example of how to call gallery intent with particular picture from drawable?

I tried to used something like that but can't make it working (wrong file patch?).

Intent intent = new Intent();
            intent.setAction(Intent.ACTION_VIEW);
            intent.setDataAndType(Uri.parse("com.me.example/drawable/thisimage.png"), "image/*");
            startActivity(intent);

According to this post

You should do something like:

 String uriStr = "android.resource://"+ "com.example.myapp"+ "/" +  R.drawable.photo_h01;
 Uri uri = Uri.parse(uriStr);

I have not Eclipse in front of me but that's what I have found on several sources

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM