aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorKen Wakasa <kwakasa@google.com>2011-03-02 07:20:27 +0900
committerKen Wakasa <kwakasa@google.com>2011-03-02 07:20:27 +0900
commit18e15a1e5e30cf200e935e43a73edef25682de27 (patch)
tree741d320d4f8ec9c132c95f703fb214cb85fd0768 /java
parent8ba2ceea68982ed73844ca0ba2a1f875374913fd (diff)
downloadlatinime-18e15a1e5e30cf200e935e43a73edef25682de27.tar.gz
latinime-18e15a1e5e30cf200e935e43a73edef25682de27.tar.xz
latinime-18e15a1e5e30cf200e935e43a73edef25682de27.zip
Fix null token error
bug: 3499746 Change-Id: I76bd745b0623f4736c6b0aaf0ab42fd4b7c4f349
Diffstat (limited to 'java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 3a97846fa..ec491b7de 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -39,6 +39,7 @@ import android.media.AudioManager;
import android.net.ConnectivityManager;
import android.os.Debug;
import android.os.Handler;
+import android.os.IBinder;
import android.os.Message;
import android.os.SystemClock;
import android.os.Vibrator;
@@ -2263,6 +2264,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private void showOptionsMenuInternal(CharSequence title, CharSequence[] items,
DialogInterface.OnClickListener listener) {
+ final IBinder windowToken = mKeyboardSwitcher.getInputView().getWindowToken();
+ if (windowToken == null) return;
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(true);
builder.setIcon(R.drawable.ic_dialog_keyboard);
@@ -2273,7 +2276,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mOptionsDialog.setCanceledOnTouchOutside(true);
Window window = mOptionsDialog.getWindow();
WindowManager.LayoutParams lp = window.getAttributes();
- lp.token = mKeyboardSwitcher.getInputView().getWindowToken();
+ lp.token = windowToken;
lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
window.setAttributes(lp);
window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);