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();
}
}
}
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
581 PHP ssh2_scp_send fails to send files as intended
618 Uncaught (inpromise) Error on Electron: An object could not be cloned
611 GDB gets version error when attempting to debug with the Presense SDK (IDE)
914 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.