0

I am working on an application in which had design one keypad mobile in which added one text and 12 buttons 1,2,3..so on. want to add text like on pressing 2 getting 2, A, B, C so should enter like a text message. stuck on this could anyone please help me out? thank you if anyone helps.

Keypad mobile design

I had declared one int counter = 0; above and on the button, I am using the below code.

`
String[] input = {"2","A", "B", "C"};
            if(counter < input.length){
                value = value+(input[counter]);
                //value=value+""+d;
                String e =""+editText.getText().toString();
                editText.setText(value);
                counter++;
            }else {
                counter = 0;
            }

`

SurajSingh
  • 11
  • 3

1 Answers1

0

EditText in your xml this way:

<EditText 
    android:id="@+id/txtOppCodigoCliente"
    android:inputType="textVisiblePassword"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:maxLength="11"
    android:hint="@string/strCodigoCliente"/>

Output: android:inputType="textVisiblePassword"

More Information :

https://stackoverflow.com/a/14586341/11138845

S_i_l_e_n_t C_o_d_e_r
  • 2,179
  • 2
  • 7
  • 21