I need Open my gallery in mobile phone and select one picture which opened in imageview on activity.. nothing hard.. but I have code and thise code in simulator (genymotion)
put this code inside (anything which you use to go to gallery)
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE_REQUEST);
Then call this function
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == PICK_IMAGE_REQUEST && resultCode == RESULT_OK && data != null && data.getData() != null) {
Uri filePath = data.getData();
Bitmap img=MediaStore.Images.Media.getBitmap(getContentResolver, filePath);
If(img!= null) {
image.setImageBitmap(img);
}
}
don't forget this permission to be called