I am using the below code to browse and pick files from sd card.
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("file/*");
startActivityForResult(intent,PICKFILE_RESULT_CODE);
When user selects a file I am fetching its path using this line of code
String picturePath = data.getData().getPath();
But when I try to open this file using the below code I am getting file not found exception
InputStream inputStream = getContentResolver().openInputStream( Uri.fromFile(new File(picturePath)));
I am getting this as the path to the selected file
/external/images/media/36
How can I do this in android?
Thanks
Did you try:
Alternatively, if you want to use a File:
http://developer.android.com/reference/java/io/FileInputStream.html
Be sure to use
getAbsolutePath()instead ofgetPath();