On 02/09/2011 01:25 PM, Kostya Vasilyev wrote:
You can try setting an onShowListener for the dialog, and calling 
editText.requestFocus.

You got me on the right track, thanks.  Just requesting focus was not enough
however.  At first I was trying to do this:

InputMethodManager input_manager = (InputMethodManager) 
getSystemService(borg.INPUT_METHOD_SERVICE);
input_manager.showSoftInput(dialog_edit_text, input_manager.SHOW_IMPLICIT);

Where borg is an ApplicationContext.  This was not working, but I was doing it
right in onCreateDialog() callback.  Presumably since there was at that time
no editable field on the screen, the keyboard refused to open.  Where would
the keystrokes go?

So I put the two lines in the onShowListener callback, and
everything works.  Requesting focus was not necessary, but
that is probably be cause there was only one EditText in the
dialog.

By the way, when doing this, should I test for the presence
and state of a physical keyboard (my device doesn't have one)
or will that be done automatically?

Thanks!

Tobiah



-- Kostya

09.02.2011 23:56, Tobiah пишет:
I have a Dialog with an EditText widget in it that I'd like
to use to get a string from the user. Right now, they have
to touch inside the EditText to get the keyboard. Would it
be possible to have the keyboard open up with the Dialog and
have focus in the EditText? This would be similar to what
happens when I use the search button.

Thanks,

Tobiah




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

Reply via email to