Thanks for the reply. I tried passing 0, and it had no effect.
Perhaps my problem is related to your comment about the input focus.
Currently I have a function called SetViewGroup which is declared as
follows:
private void SetViewGroup(ViewGroup vg) {
InputMethodManager inputManager = (InputMethodManager)
this.getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(vg.getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS); // Have also tried 0
here
setContentView(vg);
}
Now I have one page that is being displayed which has and edit field.
If I tap on the edit field, the virtual keyboard appears. Now I have
a button on that page which, when tapped, calls the above function
with a ViewGroup for another page. However, when I do that the
virtual keyboard remains visible. When you talk about the input
focus, how would that apply to my situation?
Thanks.
On Aug 21, 1:51 pm, Dianne Hackborn <[email protected]> wrote:
> Did you try passing 0 in for flags instead of HIDE_NOT_ALWAYS?
>
> Also note that only the window that currently has input focus can control
> the IME.
>
>
>
> On Sat, Aug 21, 2010 at 11:46 AM, John Gaby <[email protected]> wrote:
> > I have several pages which are implemented using the ViewGroup class.
> > I display a particular page by calling:
>
> > setContentView(vg);
>
> > Now if I go to a page which has an edit control, and touch within the
> > control, the virtual keyboard is presented. If I now navigate to
> > another page (and do a new setContentView) the virtual keyboard
> > remains in place. How do I dismiss that keyboard programatically? I
> > have tried the following with out success:
>
> > InputMethodManager inputManager = (InputMethodManager)
> > this.getSystemService(Context.INPUT_METHOD_SERVICE);
>
> > inputManager.hideSoftInputFromWindow(vg.getWindowToken(),
> > InputMethodManager.HIDE_NOT_ALWAYS);
>
> > and also
>
> > getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
>
> > Any Idea?
>
> > Thanks
>
> > --
> > 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