Can't get the softinput to show up programmatically

by jade » Tue, 02 Jun 2009 23:53:56 GMT


Sponsored Links
 We have a dialog box that includes an EditText field. We'd like the
softkeyboard to already appear in the dialog when the dialog opens
instead of the user first having to touch the EditText field. I've
read other posts and tried to incorporate the suggestions but there's
something that I'm missing.


Here's my code from onStart (you'll notice that I'm calling several
similar methods because from the documentation it's not clear :

  protected void onStart() {
      editText.setFocusable(true);    // which of these should I call?
      editText.setFocusableInTouchMode(true);
      editText.requestFocus();
      editText.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN,
KeyEvent.KEYCODE_MENU));
      InputMethodManager imm = (InputMethodManager)
this.context.getSystemService(Context.INPUT_METHOD_SERVICE);
      imm.showSoftInput(editText, InputMethodManager.SHOW_FORCED);

      //android.R.attr.windowSoftInputMode | stateAlwaysVisible); //
 http://developer.android.com/reference/android/R.attr.html #windowSoftInputMode
      imm.showSoftInputFromInputMethod
(editText.getApplicationWindowToken(),
InputMethodManager.SHOW_FORCED);
      super.onStart();
   }
}


It seems like I might be able to use this type of  code
programatically (due to our project constraints, we build this dialog
programatically instead of via an xml file):   //
android.R.attr.windowSoftInputMode  stateAlwaysVisible); //
 http://developer.android.com/reference/android/R.attr.html #windowSoftInputMode

Any pointers would be appreciated!

Jade





--~--~---------~--~----~------------~-------~--~----~



Can't get the softinput to show up programmatically

by Bhargavi » Wed, 10 Jun 2009 16:33:46 GMT


 Hi Jade,

  did u get a clue on this as iam also stuck with a similar
problem..please reply back if this issue is resolved. I too need the
softkeyboard to get displayed without touching the edit box in my
dialog .

Regards,
Bhargavi



--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. NexDesire 1.1 app2sd kaga jalan.

As subject.
Baru sadar neh.
Gak jalan.
Gue kaenya kudu benerin sdcard guenya ya?
Udah naek turun gak jelas sampe jd kaga ke baca gitu?
Ada yg punya step by step on the fly how tonya sekali lg?

*timpuk pala ndiri pake genteng*


_____
have you googled anything today?

-- 
"Indonesian Android Community [id-android]" 

2. Apk yang bagus untuk nambah homescreen

Bsa pake launcher hasil rip dari Android 2.1 dari dr droid-live.com (5
homescreen, 3d app drawer), atau pake Home++, up to 7 homescreen.




-- 
"Indonesian Android Community [id-android]" 

3. Cara Membuat Partisi HTC MAGIC 32A ROM Eclair 2.1 [Made By Me]... dan Flash Rom Eclair 2.1 [Made By Me]

4. Si Amplop merh

5. unlimted internet for nexus one

6. Gridview loads in reverse on onConfigurationChanged

7. Ko ga bisa buka Root Explorer yah? ada yang tau kenapa?