Created
June 24, 2016 09:25
-
-
Save chittaranjan-khuntia/3893e8f0dbc03d4f6aac197036d57c68 to your computer and use it in GitHub Desktop.
how to get full path of a file inside sdcard in Android?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void onActivityResult(int requestCode, int resultCode, Intent intent) | |
{ | |
if (requestCode == PICK_REQUEST_CODE) | |
{ | |
if (resultCode == RESULT_OK) | |
{ | |
Uri uri = intent.getData(); | |
String type = intent.getType(); | |
LogHelper.i(TAG,"Pick completed: "+ uri + " "+type); | |
if (uri != null) | |
{ | |
String path = uri.toString(); | |
if (path.toLowerCase().startsWith("file://")) | |
{ | |
// Selected file/directory path is below | |
path = (new File(URI.create(path))).getAbsolutePath(); | |
} | |
} | |
} | |
else LogHelper.i(TAG,"Back from pick with cancel status"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment