Have you tried "et.requestFocus()" ?

2012/7/16 Simon Giddings <[email protected]>

> I have a simple dialog built with the compatibility libraries
> DialogFragment.
> It holds only
>
>    1. EditText
>    2. 2 buttons
>
> When the dialog is shown, the edit text control has the focus.
> At this point, I want to open the soft keyboard automatically.
>
> Here is what I am doing within the onCreateView method :
>     EditText et;
>     et = (EditText)v.findViewById(R.id.txtAddress);
>     Activity act = getActivity();
>     if(act != null)
>     {
>         InputMethodManager imm =
> (InputMethodManager)act.getSystemService(Context.INPUT_METHOD_SERVICE);
>         if(imm != null)
>             imm.showSoftInput(et, InputMethodManager.SHOW_FORCED);
>     }
>
> Even though I get to the showSoftInput step with no problem, the keyboard
> is still not displayed.
>
> So, how can I correctly get the soft keyboard to be shown ?
>
> --
> 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

-- 
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

Reply via email to