Android tutorial - Alert dialog in android | Android prompt user input dialog example - android app development - android studio - android development tutorial
Learn andriod - andriod tutorial - Alert dialog in android - andriod examples - andriod programs
What is Android prompt
- A prompt is text or symbols used to represent the system's readiness to perform the next command.
- A prompt may also be a text representation of where the user is currently. For example, an MS-DOS prompt or Windows command prompt may look like the example below.
- we will enchance the previous Alert Dialog example, to make it able to accept user input, just like a Prompt Dialog. More specific, this is a custom Alert Dialog example.
- See following steps:
- Create a prompt dialog layout (XML file).
- Attach the prompt dialog layout to AlertDialog.Builder.
- Attach the AlertDialog.Builder to AlertDialog.
- Done.
What is Android prompt Android Layout Files
- Two XML files, one for main screen, one for prompt dialog.
- File : res/layout/main.xml
- File : res/layout/prompts.xml
Activity
- Read the comment and Demo - android emulator - android tutorial in next step, it should be self-explorary.
- File : MainActivity.java
Demo - android emulator - android tutorial
- Start it, the “main.xml” layout is display a button and edit text (result).
- Click on the button, display a prompt dialog “prompts.xml” layout, type message “wikitechy“, and click on the “OK” button.
- User input “wikitechy” will pass to the “main.xml” layout, edittext (result), and display it.