Search code examples
androidandroid-intentparse-platformandroid-gallery

How to view an ImageView when clicked in Android


I have multiple ImageViews inside a Fragment. Each `ImageView is used as a thumbnail. I want to be able to "view" the image when the user clicks on the thumbnail.

How is effect achieved? Would I use an intent and open the device's gallery to view it? I'm not sure on what approach to take (let alone not knowing any approaches at all).

Note: the images in the thumbnails are from a Parse database. So I can not use a URI to gallery intent.


Solution

  • There are multiple ways.

    1. You can launch an activity that as an imageview inside it.
    2. Display a DialogFragment or any other fragment or dialog.

    This totally depends upon the way how you want to display your image.

    For ex- take example of wahts app . They have thumbnail. Wehn you click on the image thumbnail, they dipslay it inside a dialogFragment.

    I hope it would help you.

    I think this link might help you... This has iamgeview defined in the layour for DialogFragment.