Create your account

Already have an account? Login here

Note: By joining, you will receive periodic emails from Coursetro. You can unsubscribe from these emails.

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 become a pro member, or login to your account to view this lesson.

Alright, join now. Or login to your account if you're already a pro member.

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