Create your account

Already have an account? Login here

Create account

56. Setup Dialog Add in Java

Design + Code an Android App from Scratch

Woah, wait a second..

Scrounge up some loose change to buy this course, or login to your account to view this lesson.

Alright, buy it for $25 Or login to your account if you purchased already.

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.

Course Cirriculum