TheMangaStand TheMangaStand - 14 days ago 7
Android Question

Xamarin Android Simple Input Text Popup

I have the ability to make my own popup, with dialogs, but I don't need anything complex. I was wondering if there was a simple function I could call that would make a popup where the user entered text and then return to me that text for use.

Sorta like these popups

But with one where the user would enter text.

Fairly new so if there is something like this I wouldn't mind an example to go with it. Thanks.

Answer

If you are using Android native UI, then you can easily create an AlertDialog and add a EditText to the dialog.

EditText et = new EditText(this);
AlertDialog.Builder ad = new AlertDialog.Builder (this);
ad.SetTitle ("Type text");
ad.SetView(et); // <----
ad.Show();