"Virtual Keyboard" - Java Android

Asked

Viewed 355 times

1

Good, I could use a little help. I was thinking of creating a kind of keyboard with just a few buttons for my Android application but I’m not getting what I want. Teclado

I intended to create this keyboard and type the characters in the white bar above, which is an Edittext already created. The problem I’m having is that whenever I press a button, only its value appears in the bar, and not the sequence as usually happens with any keyboard. I think it’s because of the "setText" that exists in the method of each button but I don’t know any way to solve it. Thank you if you can help me

  • by what I can understand You want to press the button and while it has pressed the respective character is repeating itself in the edit box, eh this?

  • I really wanted to turn those buttons into a normal keyboard

  • Dude, it would be the same if Oce set up a normal layout and implemented the normal keyboard events of the device via code, easy to solve, something like, let’s assume, the "(": in the layout a button and in the code its respective onclick, onlongclick and so on. Is that it? or Voce want to use the device’s own keyboard? I’m still floating...

  • Armando, I just wanted to create a keyboard with those buttons.

1 answer

1


You can use the method append() of Edittext. It will add what you pass as parameter to what is already present in Edittext.

editText.append(")");
editText.append("1");
  • Thank you Leonardo, but by the way, a little doubt, if I create the delete button as I do?

  • The second code snippet of this answer removes the last character of a EditText.

  • Thank you very much :) Ta solved

Browser other questions tagged

You are not signed in. Login or sign up in order to post.