Android - Obtain Uri to image on sdcard?

First you need to read the file from your SDCard See: reading a specific file from sdcard in android developer.android.com/reference/java/io/... File dir = Environment. GetExternalStorageDirectory(); File yourFile = new File(dir, "path/to/the/file/inside/the/sdcard. Ext") Then call the File.toUri() method to retreive the URI from the file Intent intent = new Intent(Intent.

ACTION_VIEW, yourFile.toURI()); startActivity(intent).

First you need to read the file from your SDCard. See: reading a specific file from sdcard in android developer.android.com/reference/java/io/... File dir = Environment. GetExternalStorageDirectory(); File yourFile = new File(dir, "path/to/the/file/inside/the/sdcard.

Ext"); Then call the File.toUri() method to retreive the URI from the file. Intent intent = new Intent(Intent. ACTION_VIEW, yourFile.toURI()); startActivity(intent).

Thank you, but it is not working right. First, there is an error, because the second parameter of the Intent() constructor should be android.net. Uri, and it is java.net.URI.

Also, the method yourFile.toUri() returns the file:/ URI, while I want the content:// URI. – Gabriel Jul 17 at 22:48.

I need to launch this intent so I can view the image. How do I obtain the uri, when I have got only the absolute path to the image?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions