Dialogs can be a great way to present or collect information in an Android app, but each dialog takes a good bit of code. I'll describe an architecture for creating reusable dialog components that can be used multiple times in your app.
- [Narrator] In Android apps, dialogs are used to…communicate with the user and also sometimes…to collect small amounts of information,…but creating dialog classes and layouts takes some time.…If you want to use them at all,…it's a good idea to create reusable classes,…that can be used multiple times in your apps.…In this tip I'm going to share some code that I created…for one of my apps that's saved me a lot of time.…I had to collect little bits of text from the user…in different contexts.…The prompt might change, the value might change,…but I wanted the dialog to always look the same,…so I created a reusable Java class.…
I'll start by creating a layout file…that defines my dialog's user interface.…I'll go to my layout folder, under resources,…and I'll create a new layout resource file.…I'll name it dialog_edit_text.…I won't worry about the Root element,…because I'm going to go get the code from a gist on GitHub.…Notice as I add files,…I'm adding them to my GitHub repository.…Now I'll go to a browser,…and I'll navigate to "git.io/v9i07,"…
Skill Level Intermediate
Q: Why can't I earn a Certificate of Completion for this course?
A: We publish a new tutorial or tutorials for this course on a regular basis. We are unable to offer a Certificate of Completion because it is an ever-evolving course that is not designed to be completed. Check back often for new movies.