‫Hello my friends.
‫In this video we will allow the user to select the image from the gallery.
‫But first I will add here on Failure Listener.
‫Add on failure.
‫Listener if.
‫This.
‫This upload is not done correctly.
‫We need to show the progress bar binding dot progress bar dot visibility equal to view dot visible or
‫invisible.
‫I need to hide at first the progress bar and.
‫Here.
‫If we scroll up, we can see F So this f it's ending here.
‫I need to add else statement else binding dot progress bar dot visibility equal to view dot invisible.
‫If I am uploading the image, then display for me the progress bar.
‫And.
‫And when finish Onsuccess listener you need to hide the progress bar.
‫Otherwise, if any failure or if we are not uploading it successfully, then make it invisible.
‫Now.
‫I will override a method called on activity result.
‫This on activity result.
‫We need to get the image from the gallery.
‫So if.
‫If.
‫Request code.
‫Equal.
‫Equal to one.
‫And the result code.
‫These are the parameters from here.
‫Equal.
‫Equal to result.
‫Okay.
‫Then what to do?
‫We need to get the actual image path and showing the image if data.
‫Now let's check if the data doesn't equal to null.
‫Then image your I equal to data dot get data.
‫From the data.
‫We need to get the data.
‫And here ad non null asserted operator and image view binding.
‫Dot image view.
‫Dot set Image.
‫Uri.
‫To image your eye.
‫Okay, Here we are showing the image and here we are getting the actual image.
‫Okay.
‫Actual image path.
‫This is how we get the image from the gallery.
‫Now we will add on start method.
‫I will override it on Start.
‫We need to check for the user.
‫We need to get the authentication for the user.
‫So here the on start method user equal to auth dot get current user alt plus enter to add non-null inserted
‫all non null asserted operator then auth.
‫Add us state listener auth.
‫Listener.
‫Or I can remove it like this because I don't need a listeners here.
‫On.
‫Stop.
‫If.
‫You can check for oath doesn't equal to null.
‫Then you can like remove author, state listener or do something else.
‫Okay, but then now we have finished this.
‫Activity.
‫Let's move to the next step, which is the main activity.