2

I have a LinearLayout and an associated Activity. In my view there is an EditText's box and a bunch of Buttons. When I start the application, focus goes immediately to the EditTexts box and the soft keyboard comes up. Is there a way to avoid this so that it just comes up with nothing selected and no soft keyboard popping up? I have tried findViewById().clearFocus() and requestFocus() on different views, but nothing seems to work.

Yurets
  • 3,999
  • 17
  • 54
  • 74
user306517
  • 523
  • 8
  • 21

1 Answers1

2

Change your Activity settings in manifest like below:

<activity
    android:name=".MyActivity"
    android:windowSoftInputMode="stateHidden">
</activity>
pawelzieba
  • 16,082
  • 3
  • 46
  • 72
  • cool, that works, but the edit box is still selected. I even try to findViewById(R.id.myedittext).setSelected(false) and it's *still* selected... – user306517 Feb 21 '11 at 17:37
  • heh, I found answer, it's ...funny: http://stackoverflow.com/questions/1555109/stop-edittext-from-gaining-focus-at-activity-startup – pawelzieba Feb 21 '11 at 17:56