Hello James, Thanks for the code snippet. I've actually tried this.
What device did you test this on? My biggest problem is that when I find a combination that works on the G1, it doesn't work on the G2 (HTC Hero) or vice-versa. I'm expecting a nightmare when we have 12 devices out there instead of just 2. -DWass On Sep 25, 7:14 am, James W <jpbwebs...@gmail.com> wrote: > 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 > automaticallyshowwhen 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 thekeyboardwhen 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 thekeyboardis 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! > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---