I'm working on a photo selection option on my app. There is a button and an image view in the layout, but if I click the button, it connects to the gallery and you can choose the image. If I select an image, I want it to appear in the image view, but how do I make the gallery float and select an image?
android android-image android-gallery
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType(android.provider.MediaStore.Images.Media.CONTENT_TYPE);
intent.setData(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, GET_PICTURE_URI);
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == GET_PICTURE_URI) {
if (resultCode == Activity.RESULT_OK) {
URI uri = data.getData();
}
}
}
© 2024 OneMinuteCode. All rights reserved.