-
-
Save sendtomitesh/6117162d7eda8a4d6cb4 to your computer and use it in GitHub Desktop.
Simple text entery dialog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AlertDialog.Builder builder = new AlertDialog.Builder(this); | |
| builder.setTitle("Title"); | |
| // Set up the input | |
| final EditText input = new EditText(this); | |
| // Specify the type of input expected; this, for example, sets the input as a password, and will mask the text | |
| input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); | |
| builder.setView(input); | |
| // Set up the buttons | |
| builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { | |
| @Override | |
| public void onClick(DialogInterface dialog, int which) { | |
| m_Text = input.getText().toString(); | |
| } | |
| }); | |
| builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { | |
| @Override | |
| public void onClick(DialogInterface dialog, int which) { | |
| dialog.cancel(); | |
| } | |
| }); | |
| builder.show(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment