I have a problem with a custom dialog. my dialog consists of a textview, edittext and an "ok" button. after clicking "ok", it should get the text from edittext field and assign it to the string variable "name" defined in the activity.. I am new to android development and i want to show an alert dialog box for an edit text field. user should enter his weight from 10kg to 99kg only if he enters more than 2 digits alert dialog box should appear, and also with out entering the weight if we press the measure button it should show the alert dialog. plz some one help me with sample code.. Input text dialog android. ask question. up vote 225 down vote favorite. 58. when a user clicks a button in my app (which is printed in a surfaceview), i'd like a text dialog to appear and i would like to store the result in a string. allow user to edit button text on long click in android..
Display the dialog, adding the fragment using an existing transaction and then committing the transaction. void shownow ( fragmentmanager manager, string tag). An inputtype of "numericpassword" results in an edit text that accepts numbers only, shows a numeric keyboard when focused, and masks the text that is entered for privacy. see the text fields guide for examples of other r.styleable.textview_inputtype settings.. A dialog only contains one root view, that's why setview() overwrites the first edittext. the solution is simple put everything in one viewgroup, for instance a linearlayout: the solution is simple put everything in one viewgroup, for instance a linearlayout:.