Quantcast
Channel: Android Mode - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 941

Unicode Keypress recognise

$
0
0

Hello, I am trying to simply println a value when a non alphabetical key is pressed in the keyboard on an Android Tablet. Specifically I hope to recognise if an emoji key has been pressed.

I cannot seem to get any kind of unicode to convert to char. I have been looking at this post to try and implement the given example but I cannot get it to compile successfully. https://forum.processing.org/two/discussion/9296/getunicodechar-in-android-mode#latest

I am running Android KitKat 4.4.4

I have also been trying to get a simple keycode to be recognised via the code below:

    import android.view.KeyEvent;
    KeyEvent event;
    boolean keyboard = false;
    int unicodeChar=0;

    void setup() {
      fullScreen();
      textFont(createFont("SansSerif", 40 * displayDensity));
      fill(0);
      unicodeChar = event.getUnicodeChar();
    }

    void draw() {
      background(255);
      text(key, width/2, height/2-50);
    }

    void keyPressed() {
      background(200, 50, 30);
      if (key == CODED)
      {
        println("code => " + keyCode);

        if (key==unicodeChar) {

          println("unicode" + unicodeChar);
        }
      } else
        println(key);
    }

    void mousePressed() {
      if (!keyboard) {
        openKeyboard();
        keyboard = true;
      } else {
        closeKeyboard();
        keyboard = false;
      }
    }

From reading the emoji and unicode posts for java based Processing it seems there are issues with being able to implement emoji unicode. However, I wonder if the same issues carry over into Android mode?

Any pointers in the right direction would be really appreciated. thanks


Viewing all articles
Browse latest Browse all 941

Trending Articles