Retrieve Images from firebase Storage (PART-3)

hey guys welcome back so today in this video we will talk about when you click on these items ,then what will happen as you can see when i click on this items then it is opening in a new activity and size of image is also big and text is showing here so today we will talk about how you can implement this in your project first of all go to viewholder class and open it here we have to create some methods write private viewholder clicklistener mclicklistener then public interface click clicklistener as you can see the error is solved after this inside this we will type on item click on item click view view int position position after this copy this then paste it change onItemclick to OnItemlongclick so after this create another method public then void set onClicklistener click listener then again viewholder clicklistener then click listener after this write mclicklistener equals to clicklistener so here our class is complete after this go to mainactivity . java but before this we have to create a new activity in which our images and text will expand,so i have already created the activity as you can see this is our activity this is mainactivity and its xml file so open xml file first and then deleting deleting after this open images.xml layout file and simply copy it after copying it go to activity2 xml file and paste it as you can see it is done but you have to make some changes follow steps follow steps follow steps so now its ok . but we have to change some attributes in its layout file follow delete it after this width make it match_parent and height will be 100dp and then make its orientation vertical

now after this linear layout we have used here simply copy it and follow steps paste it so as you can see i have pasted it and delete it and follow steps follow steps so i think imageview something is wrong delete layout let me delete it now everything is fine and delete it now switch to design section as you can see our title will show here and this is imageview you can understand easily you can this you can create xml file from here but i prefer typing because it easy and drag and drop takes time but it depends on you which way you want to work so our activity is complete go back to mainactivity.java here first of all come inside this method protected void populate view holder after this here i forgot to so after creating these methods after this come inside viewholder method follow steps follow steps item view setonclicklistener new onclicklistener and inside this we will write mclicklistener onItemclick as you can see it is showing click on it and then write view getadapterposition and after this write item view choose on item longclick listener new on item longclick listener and below this don’t delete anything , simply write mclicklistener onitem longclick listener then view follow steps follow our viewholder .java part is complete now no go to mainactivity .java here you have to follow you have to call a method type oncreate it is showing here select it now it is showing on the screen follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps as you can see these methods onitemclick and on item long click so so it depends on you what you want to do on long click so you can do your own implementation its on you if you want something to do so you can

now come inside in itemclick follow steps follow steps follow steps follow steps follow steps change ID as showing follow steps so it will make coding easy otherwise you will confuse because of same ID follow steps follow steps follow steps follow steps follow steps follow steps then follow steps follow steps follow steps follow steps follow steps follow steps follow steps so after this we will define some string equals to follow steps follow steps follow steps follow steps and then again this time we will use drawable follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps for this we need to compress it follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps now we use intent for sending our data follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps as you can see why is there an error showing follow steps now as you can see there is no error ater this follow steps follow steps now we have to convert image into bytes so here we will use bytes follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps because our photos are in PNG format follow steps follow steps follow steps follow steps follow steps follow steps

follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps after this we will write start activity if we don’t write start activity then intent will not work now our coding is complete this is our second method it on you what you want to do in second method when item is clicked so here follow steps delete it and write viewholder so our mainactivity .java is complete now we will code mainactivity 2 open mainAcitvity 2 here we have to define some variables follow steps follow steps follow steps follow steps follow steps follow steps follow steps pass it true follow steps follow steps follow steps here we will give reference follow steps follow steps follow steps follow steps here we will give reference let me clear one mistake so here in this activity the reference is wrong ID is wrong remove 2 from it as you can see so follow steps follow steps follow steps we have to send data from images layout to mainactivity 2 by using intent by mistake i given wrong reference please change it here we will use rtitle tv 2 follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps

follow steps copy this paste it here follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps our coding is complete and now we will run this app is it working or not run your app is it working or not if you get any error then let me know in comment section i will try to reply in next 24 hrs as you can see our app is running successfully successfully images and text is retrieved so check it as you can see it is opening in new activity image is expanded our app is working successfully