How to get URI of image stored on SD-Card?
Step 1:- Read the image from SD-Card.
1 2 |
File sdCardDir = Environment.getExternalStorageDirectory(); File yourFile = new File(sdCardDir, "path/to/the/file/filename.ext"); |
Step 2:- Once you get object of image file, you can get URI of the image.
1 |
Uri imageUri = yourFile.toUri(); |
Next:-
You ready to use URI wherever you want. Below e.g. shows we can use it to start intent for the same image.
1 2 |
Intent intent = new Intent(Intent.ACTION_VIEW, imageUri); startActivity(intent); |
Not very tough, but love sharing this stuff.