to make it work on every phone you should delay the softInputMode only
once the keyboard is compeltely visible.
something like this really help that much:
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
InputMethodManager imm = (InputMethodManager)
getSystemService(INPUT_METHOD_SERVICE);
if (imm != null) {
imm.hideSoftInputFromWindow(input.getWindowToken(),
0);
}
}
}, 100);
But I don't know if 100milliseconds is enough for every phone/tablet.
On Sep 10, 1:36 pm, Mark Murphy <[email protected]> wrote:
> On Fri, Sep 9, 2011 at 11:02 PM, martypantsROK <[email protected]> wrote:
> > I am using
>
> > confirmButton.setOnClickListener(new View.OnClickListener() {
> > public void onClick(View view) {
> > //hide keyboard :
>
> > getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
>
> > // do stuff
> > }
> > });
>
> > but this doesn't hide the keyboard.
>
> This is not surprising.
>
> > Is being inside the view of the button
> > affecting my ability to hide the keyboard in the parent window?
>
> No. The parent window doesn't have the keyboard in the first place.
>
> Use:
>
> InputMethodManager
> imm=(InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
>
> imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
>
> where v is the EditText that has the input method editor open.
>
> --
> Mark Murphy (a Commons
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Warescription: Three Android Books, Plus Updates, One Low Price!
--
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