i have created an XML and dialog fragment consist of Edittext and numeric buttons (keypad). i had searched alot but only found creating custom softkey solutions. my objective is very simple. i already had all the buttons created in XML. what should i add to so that when "1" is pressed, edittext will display "1", "2" is pressed display "12", 3 will display "123"... etc. some source code for me would be useful, I know how to display "1" in edit text when i pressed "1", which method to use to display 2 next to 1 when i press 2
need help to create custom keypad INSIDE a dialogFragment. do not want system keyboard to pop out
163 views Asked by Eric Ong At
1
In XML insert onClick commands for each button. In your activity, create a method for each onClick defined, this way:
In XML:
In the activity you should have a method like this one:
It should work. You can always use
getText()
to get the content andsetText(newText)
to set the content. Please note that if you click on the EditText this way you will still get the system keyboard pop up, if you want to only show the value use a TextView instead.Hope it helps.