Within the OnClickListener of your button (or in a function called from there): AlertDialog.Builder builder = new AlertDialog.Builder(this) įinal EditText input = new EditText(this) Within your class: private String m_Text = "" (I can edit and elaborate more if this is what you need). If you can't use a member variable, you may need to use a listener to send the string value to the right place. If you're able to use a member variable, you can simply set the variable to the value of the EditText, and it will persist after the dialog has dismissed. You can customize the type of input allowed using setInputType, if you need. You simply need to create an EditText for the user to input data, and set it as the view of the AlertDialog. Fortunately, it's just a little extra work on top of creating a standard AlertDialog. Sounds like a good opportunity to use an AlertDialog.Īs basic as it seems, Android does not have a built-in dialog to do this (as far as I know).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |