You can't use this, it is only for the system. What you can do is use TYPE_APPLICATION_PANEL with the token set to your main IME window's token, to have the second window attached to the IME.
On Mon, Apr 16, 2012 at 5:46 PM, tsukishiro <[email protected]> wrote: > Hello, > > I wanted to show a custom dialog form within my input method service. I > read from this > thread<http://stackoverflow.com/questions/7218360/how-to-call-activity-from-inputmethodservice-and-get-response> > that > the dialog's type should be set to > WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG. However, when I tried > to do this and test my IME, I got the following error : > > E/AndroidRuntime( 685): FATAL EXCEPTION: main > E/AndroidRuntime( 685): android.view.WindowManager$BadTokenException: > Unable to add window android.view.ViewRoot$W@40519010 -- permission > denied for this window type > E/AndroidRuntime( 685): at > android.view.ViewRoot.setView(ViewRoot.java:551) > E/AndroidRuntime( 685): at > android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177) > E/AndroidRuntime( 685): at > android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91) > E/AndroidRuntime( 685): at android.app.Dialog.show(Dialog.java:241) > E/AndroidRuntime( 685): at > com.example.android.softkeyboard.SoftKeyboard.showDialog(SoftKeyboard.java:187) > E/AndroidRuntime( 685): at > com.example.android.softkeyboard.SoftKeyboard.onStartInput(SoftKeyboard.java:207) > E/AndroidRuntime( 685): at > android.inputmethodservice.InputMethodService.doStartInput(InputMethodService.java:1441) > E/AndroidRuntime( 685): at > android.inputmethodservice.InputMethodService$InputMethodImpl.startInput(InputMethodService.java:354) > E/AndroidRuntime( 685): at > android.inputmethodservice.IInputMethodWrapper.executeMessage(IInputMethodWrapper.java:152) > E/AndroidRuntime( 685): at > com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:61) > E/AndroidRuntime( 685): at > android.os.Handler.dispatchMessage(Handler.java:99) > E/AndroidRuntime( 685): at android.os.Looper.loop(Looper.java:123) > E/AndroidRuntime( 685): at > android.app.ActivityThread.main(ActivityThread.java:3683) > E/AndroidRuntime( 685): at java.lang.reflect.Method.invokeNative(Native > Method) > E/AndroidRuntime( 685): at > java.lang.reflect.Method.invoke(Method.java:507) > E/AndroidRuntime( 685): at > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) > E/AndroidRuntime( 685): at > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) > E/AndroidRuntime( 685): at dalvik.system.NativeStart.main(Native Method) > > Can someone guide me through this? I found a somewhat similar discussion > here<http://stackoverflow.com/questions/3514392/android-ime-showing-a-custom-pop-up-dialog-like-swype-keyboard-which-can-ente/6166857#6166857> > but > it uses WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG > Hoping for some help. Thanks and best regards, > - tsukishiro > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

