@@ -107,6 +107,7 @@ public class MainActivity extends NativeActivity {
107
107
private MediaPlayer _mediaPlayer = null ;
108
108
private LocationAdapter _locationAdapter = null ;
109
109
private TextToSpeechAdapter _tts ;
110
+ private Handler _keypadHandler = new Handler ();
110
111
111
112
static {
112
113
System .loadLibrary ("smallbasic" );
@@ -596,19 +597,24 @@ public void onClick(DialogInterface dialog, int which) {}
596
597
public void showKeypad (final boolean show ) {
597
598
Log .i (TAG , "showKeypad: " + show );
598
599
final View view = getWindow ().getDecorView ();
599
- final Activity activity = this ;
600
- runOnUiThread (new Runnable () {
600
+ _keypadHandler .removeCallbacksAndMessages (null );
601
+ _keypadHandler .postDelayed (new Runnable () {
602
+ @ Override
601
603
public void run () {
602
- InputMethodManager imm = (InputMethodManager )getSystemService (Context .INPUT_METHOD_SERVICE );
603
- if (imm != null ) {
604
- if (show ) {
605
- imm .showSoftInput (view , InputMethodManager .SHOW_IMPLICIT );
606
- } else {
607
- imm .hideSoftInputFromWindow (view .getWindowToken (), InputMethodManager .HIDE_NOT_ALWAYS );
604
+ runOnUiThread (new Runnable () {
605
+ public void run () {
606
+ InputMethodManager imm = (InputMethodManager ) getSystemService (Context .INPUT_METHOD_SERVICE );
607
+ if (imm != null ) {
608
+ if (show ) {
609
+ imm .showSoftInput (view , InputMethodManager .SHOW_IMPLICIT );
610
+ } else {
611
+ imm .hideSoftInputFromWindow (view .getWindowToken (), InputMethodManager .HIDE_NOT_ALWAYS );
612
+ }
613
+ }
608
614
}
609
- }
615
+ });
610
616
}
611
- });
617
+ }, 100 );
612
618
}
613
619
614
620
public void showToast (final byte [] messageBytes ) {
0 commit comments