I have an ImagePreviewActivity for preview the images that upload from gallery as well as captured image.In this activity itself showing a recylerview having the all images,onclick of that item i need to preview that image in that activity itself
You can follow this step
In ImagePreviewActivity xml
- Put your recyclerview in one viewgroup, can be LinearLayout
- add your preview <ImageView in another viewgroup with clear button to close or hide it later
- onclick of your item, extract the url and pass it to the new image you added, then hide the recycler view on that spot.. you can set the with and height of the ImageView viewgroup to match parent so can full the screen.
- Onclick of the clear button in your ImageViewGroup, you can set the ImageViewGroup to gone and show your recyclerView.
Another approach, you can create fragment and swap the two fragment.