Skip to content

Commit 8be54d3

Browse files
authored
Merge pull request #305 from gunkiratk/multitouch
Added open and close functionality of Soft keyboard
2 parents 759c71a + 7128ee6 commit 8be54d3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

core/src/processing/core/PApplet.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import java.util.regex.*;
3434
import java.util.zip.*;
3535

36+
import android.view.inputmethod.InputMethodManager;
3637
import android.app.Activity;
3738
import android.content.*;
3839
import android.content.pm.PackageManager;
@@ -768,6 +769,18 @@ public boolean checkPermission(String permission) {
768769
return false;
769770
}
770771
}
772+
773+
public void openKeyboard() {
774+
Context context = surface.getContext();
775+
InputMethodManager imm = (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
776+
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
777+
}
778+
779+
public void closeKeyboard() {
780+
Context context = surface.getContext();
781+
InputMethodManager imm = (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
782+
imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
783+
}
771784

772785

773786
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

0 commit comments

Comments
 (0)