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

Call android keyboard doesn't work

$
0
0

hi, I've tried to run keyboard on android and I get an error. the error is: the function getSystemService does not exist. here is the code.

import android.view.inputmethod.InputMethodManager;
import android.content.Context;
boolean showing=false;

void setup() {
  fullScreen();
}

void draw() {
  if (showing)
    showVirtualKeyboard();
  else
    hideVirtualKeyboard();
}

void mousePressed() {
  showing=true;
}

void showVirtualKeyboard() {
  InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
  imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}

void hideVirtualKeyboard() {
  InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
  imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
}

anybody knows why?


Viewing all articles
Browse latest Browse all 941

Trending Articles