Ah sorry 0 is correct here. Are you sure the window you are passing in actually currently has input focus? Fwiw, the framework code that hides/shows the IME from long pressing on menu does basically the same thing -- shows with the force flag, hides with 0 flags.
2009/11/11 sdphil <[email protected]> > I'm basically doing what you show here. > > What I mean by "forced" soft keyboard is when you hold down the menu > key. > > It doesn't make it go away. I tried using > view.getApplicationWindowToken vs. view.getWindowToken > > and it did not make any difference. so something else must be going > on... > > On Nov 11, 7:02 pm, zhanglei(张雷) <[email protected]> wrote: > > InputMethodManager m_inputManager = null; > > //show input > > m_inputManager = (InputMethodManager) > getSystemService(Context.INPUT_METHOD_SERVICE); > > m_inputManager.showSoftInput( > this.getCurrentFocus(),InputMethodManager.SHOW_FORCED ); > > > > //hide input > > private boolean hideInputMethod( ) > > { > > boolean bHideIM = > m_inputManager.hideSoftInputFromWindow(name.getWindowToken(), 0); //hide > Input Method > > if( false == bHideIM ) > > { > > Log.e( TAG, "hide InputMethod is error!" ); > > } > > return bHideIM; > > } > > > > -----邮件原件----- > > 发件人: sdphil [mailto:[email protected]] > > 发送时间: 2009年11月12日 10:43 > > 收件人: Android Developers > > 主题: [android-developers] Re: hiding a forcibly opened soft keyboard... > > > > What flag is that? All I see documented are -- > > > > int HIDE_IMPLICIT_ONLY Flag for hideSoftInputFromWindow(IBinder, > > int) to indicate that the soft input window should only be hidden if > > it was not explicitly shown by the user. > > int HIDE_NOT_ALWAYS Flag for hideSoftInputFromWindow(IBinder, > int) > > to indicate that the soft input window should normally be hidden, > > unless it was originally shown with SHOW_FORCED. > > > > http://developer.android.com/intl/fr/reference/android/view/inputmeth... > > > > tia. > > > > On Nov 11, 6:40 pm, Dianne Hackborn <[email protected]> wrote: > > > > > > > > > You need to pass the flag to force it to be hidden. > > > > > On Wed, Nov 11, 2009 at 5:09 PM, sdphil <[email protected]> > wrote: > > > > i am attempting to hide a forcibly opened soft keyboard using -- > > > > > > // hide the soft keyboard. > > > > View view = (View) findViewById(R.id.DebugText); > > > > InputMethodManager manager = (InputMethodManager) > > > > getSystemService(Context.INPUT_METHOD_SERVICE); > > > > IBinder binder = view.getApplicationWindowToken(); > > > > if (binder != null) { > > > > manager.hideSoftInputFromWindow(binder, 0); > > > > } > > > > > > but it doesn't seem to be working - any ideas? > > > > > > tia. > > > > > > -- > > > > 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]<android-developers%[email protected]> > <android-developers%[email protected]<android-developers%[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]<android-developers%[email protected]> > > For more options, visit this group athttp:// > groups.google.com/group/android-developers?hl=en > > -- > 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]<android-developers%[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

