The reason I'm asking about this is because the Intent file select callback returns a Uri .
Open file with intent:
Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "Select Picture"), CHOOSE_IMAGE_REQUEST);
Callback:
@Override public void onActivityResult(int requestCode, int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == CHOOSE_IMAGE_REQUEST && resultCode == Activity.RESULT_OK) { if (data == null) {
One way is to write an InputStream to the actual File , but this seems like a bad workaround to me.
source share