Design + Code an Android App from Scratch
This video shows how to add the DialogFragment in code for adding drops to our database. In the first step, we create a class that extends DialogFragment, in the next step we override the onCreateView method and link the XML layout which we created in the last video. We create an on click listener inside our Activity which will be triggered when the users tries to add a new drop. Then we create an object of our DialogFragment class and call the show method that accepts a FragmentManager or a FragmentTransaction. We filter the input entered by the user using an inputType and finally add another ClickListener inside the Dialog to dismiss it when the person tries to close the Dialog.