Created an app for the first time in a long time. I decided to add an image acquisition function as an additional function.
The process here is like a preparatory stage before image acquisition, so I'm calling the gallery ... I wonder if it's okay. Prepare an Intent, add two functions to it, and start the activity. And the stage that enables the transfer of information.
findViewById(R.id.activity_detail_select_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("image/*");
startActivityForResult(intent, RESULT_PICK_IMAGEFILE);
}
});
Complete miscellaneous notes from here
ACTION_OPEN_DOCUMENT
Intent for selecting files using the picker → Picker = Interface
CATEGORY_OPENABLE
Passing URI A URI is for identifying a name or location By passing this, if it is this time, add an image
"image/*"
→ Select this as the character string type
startActivityForResult
→ Launch an activity and allow it to receive some information from the activity
I am not confident at all, so it would be very helpful if you could point out.