Dwass, dont know if this helps, but I finally got it to work reliably for my particular needs.
I have a dialog with a single edit, and I wanted to softkeyboard to automatically show when the dialog was opened, and be closed when the dialog was closed. In other words, identical behaviour to the EditTextPreference when used in a PreferenceScreen. In my OnCreate() I have: InputMethodManager imm = (InputMethodManager) SingleEditDialog.this.getContext().getSystemService (Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput (InputMethodManager.SHOW_FORCED,InputMethodManager.HIDE_IMPLICIT_ONLY); Which shows the keyboard when the dialog is opened. Like you, I had trouble getting the thing to hide when I close the dialog, I tried calling toggleSoftInput again but no amount of changing the settings seems to work. It is not entirely clear what is going on here, and I am not sure why there is not a .HIDE_FORCED option. It is my app, why can't I control when the keyboard is shown? In the end, as I only had one edit field, I was able to use another method to hide it, imm.hideSoftInputFromWindow(singleedittext.getWindowToken(), 0); where singleedittext is my EditText view. Incidentally, there doesn't appear to be a corresponding showSoftInputForWindow() call, though, which is again odd. Anyway, it now works perfectly. Hope this helps someone else! On Sep 22, 4:06 pm, dwass <dw...@sharpmind.de> wrote: > Hi Dianne, > > You say that the G1 has akeyboardand so the IME is not shown by > default. I don't understand that statement. Yes, the G1 has akeyboard, but it > isn't always OPEN. Especially if the device is in > portrait mode, thekeyboardis probably NEVER open. The device should > be smart enough so that it opens thekeyboardif there is nokeyboard > open. Either that, or we need a way to show thekeyboardwhen we want > to (and hide it again when we don't). > > My current problem is this: When I start an activity, the first > EditText field in the layout is focused automatically, but the softkeyboardis > not automatically shown. The user must either click (with > trackball) or touch the field to open the softkeyboard. IMHO the > developer should be able to say that he wants thekeyboardshown at > this point. > > Any suggestions? I've tried all the "force showkeyboard" suggestions > and they sometimes do work, but usually you get stuck with thekeyboardbeing > shown after you leave the field and this causes more > problems that it solves. > > Thanks, > -DWass > > > > > On Sep 19, 8:42 am, Dianne Hackborn <hack...@android.com> wrote: > > > > The G1 has akeyboard, so it works as I said -- the IME is not shown by > > > default. This is a policy decision of the platform. > > > > On a myTouch, since it doesn't have akeyboard, the IME will be shown by > > > default in various cases (for example when you enter the edit contacts > > > screen) when the app has indicated that is desired with the input options. > > > > -- > > > Dianne Hackborn > > > Android framework engineer- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---