Search code examples
androidbuttontextinputandroid-softkeyboard

How to change the Button text with the android keyboard?


I created a button in my xml (normal button) with text set to "0". I attached an OnClickListner to it, and I got the keyboard to show using this code:

public void Measure(View paramView) {
    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
}

Now I want the text in the button to change when I write something using the popped up keyboard. I want to fill it with numbers - example 13.45.

I don't want to change the button to an editText.

Anyone got an idea how to do this? Can anyone help? Thanks in advance for all the replies.


Solution

  • Instead of using button use an edit text and change the background of the edittext to make it look like a button