We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello, I want to get the value of the keypresses with getUnicodeChar()
import android.view.KeyEvent;
KeyEvent event;
int unicodeChar=0;
void draw()
{
if(mousePressed == true){showVirtualKeyboard();delay(888);}
unicodeChar = event.getUnicodeChar();
text(unicodeChar , 22, 22);
delay(1000);
}
public void showVirtualKeyboard() { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); }
This code does not work, that I can do?
thanks
Comments
@anthony20=== try this
--------or (more simple to understand) == (anyway the problem is that in your drawcode the event is always null and so you cannot call event.getUnicodeChar())
Hi, @akenaton Thanks for help me,
I don´t understand...
This code work well in tablet and samsung galaxy ace. But in samsung galaxy mini i only can read numeric chars.
When I press the other characters nothing happens, it is as if the keyboard not connected to event, and the data Char is lost.
what running? 2.3................................4.4???
is 4.0.3
same result with my code(try the twos, dispatchevent && onKeyUp())???
same result with my code(try the twos, dispatchevent && onKeyUp())??? What returns the println() as for me i have tested on 2 phones and it works...
Hi @Akenaton, thanks for the help me,
I really do not understand why this error happens.
Anyway, finally I was able to successfully implement the apwidgets library.
So I'm going to rule out using getUnicodeChar ()
yet i am curious to know what returns println()
I do it:
text(int(unicodeChar),random(800),random(380));
some keys, especially numbers give correct values. However most of letters and other keys are not displayed when pressed, as if these characters were not prosecuted.println returns nothing,
The strange thing is that the code works other devices with apparent normality.