O'Reilly logo

Android Programming for Beginners by John Horton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Coding the dialog boxes

Now that we have a design for both our dialog windows (show note and new note), we can use what we know about the FragmentDialog class to implement a class that represents each of the dialog windows that the user can interact with.

We will start with the new note screen.

Coding the DialogNewNote class

Create a new class by right-clicking on the project folder that contains all the .java files and choose Java class under New. Name the class DialogNewNote.

First, change the class declaration and extend DialogFragment. Also, override the onCreateDialog method, which is where all the rest of the code in this class will go:

public class DialogNewNote extends DialogFragment { @Override public Dialog onCreateDialog(Bundle savedInstanceState) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required