Last active
August 7, 2020 06:47
-
-
Save crazy-diya/d6c86155fb837e43cd603d8537d24753 to your computer and use it in GitHub Desktop.
Access mobile storage in Android Studio Java
This file contains 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
/**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