- Launch photo picker using Intent.ACTION_GET_CONTENT
- Retrieve URI of selected item
Retrieve PATH of URI so that I can POST it to my webserver
Code to launch browse
Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); startActivityForResult(intent, BROWSE_IMAGE_REQUEST_CODE);
Code to retrieve selected image
if (RESULT_OK == resultCode && BROWSE_IMAGE_REQUEST_CODE == requestCode) { Uri uri = data.getData();
Code to send to the webserver
File file = new File(uri.getPath()); new FileSystemResourceFile(file);
I am currently able to retrieve the PATH from the URI no prob /external/images/media/24
but for some weird reason file is always null, help please?