I want to open an image in my drawable folder via default imageview applications of my phone (Gallery, etc.).
My image location: drawable/image.png
Code:
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(""), "image/*");
startActivity(intent);
What do I need to write in Uri.parse function to see the image file?
To do that you have to copy your image in drawable folder to SD card and then give the path of the file in SD card to intent.
Here is the code:
Note that imagename is the name of the image in your drawable folder
And don't forget to add permission for accessing SD card in manifest file
you can access your image by this code :
for example you can use this code in your "onCreate" method:
I don't think you can do that. This drawable is private for your application and other apps can't use it. You should create your own
ImageViewer
or copy these drawables to SD card and set thatUri
when starting theIntent
.