Search code examples
androidandroid-intentandroid-gallery

how to launch photo gallery with search parameter in Android programatically


I am trying to programatically launch or open the photo gallery after passing a photo name search parameter. I am new at this. I am thinking maybe intents can be used but not sure so I am wondering if anyone could please point me in the right direction. Preferably with some code examples.

Much thanks.

RE-EDIT

As requested, this is the code I have so far..

Intent intent = new Intent();
                        intent.setType("image/*");
                        intent.setAction(Intent.ACTION_GET_CONTENT);
                        // CAMERA_PIC_REQUEST = 2600;

                        cameraIntent = Intent.createChooser(intent,"Select Picture");

Solution

  • you can try follow code:

    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(photoUri);
    context.startActivity(intent);