Skip to content

Instantly share code, notes, and snippets.

@crazy-diya
Last active August 7, 2020 06:47
Show Gist options
  • Save crazy-diya/d6c86155fb837e43cd603d8537d24753 to your computer and use it in GitHub Desktop.
Save crazy-diya/d6c86155fb837e43cd603d8537d24753 to your computer and use it in GitHub Desktop.
Access mobile storage in Android Studio Java
/**Start Access the mobile file location for get the image and set the image into image view*/
private void FileChooser() {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(intent,1);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 1 && resultCode == RESULT_OK && data != null && data.getData() != null)
{
imguri = data.getData();
System.out.println("*******************"+imguri);
Picasso.get().load(imguri).into(imageView);
//imageView.setImageURI(imguri);
}
}
/**End Access the mobile file location for get the image and set the image into image view*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment