Skip to main content
fixed grammar and improved formatting
Source Link
Ramesh R
  • 7.1k
  • 4
  • 27
  • 40

I have an Activity in Android, with two elements:

  1. EditText
  2. ListView

When my Activity starts, the EditText immediately has the input focus (flashing cursor). I don't want any control to have input focus at startup. I tried:

EditText.setSelected(false); EditText.setFocusable(false); 

No luck. How can I convince the EditText to not select itself when the Activity starts?

I have an Activity in Android, with two elements:

  1. EditText
  2. ListView

When my Activity starts, the EditText immediately has input focus (flashing cursor). I don't want any control to have input focus at startup. I tried:

EditText.setSelected(false); EditText.setFocusable(false); 

No luck. How can I convince the EditText to not select itself when the Activity starts?

I have an Activity in Android, with two elements:

  1. EditText
  2. ListView

When my Activity starts, the EditText immediately has the input focus (flashing cursor). I don't want any control to have input focus at startup. I tried:

EditText.setSelected(false); EditText.setFocusable(false); 

No luck. How can I convince the EditText to not select itself when the Activity starts?

How to stop EditText from gaining focus at Activity startupwhen an activity starts in Android?

edited tags
Link
user10563627
user10563627
Title fixed and new tag added.
Source Link
Name is Nilay
  • 2.8k
  • 4
  • 38
  • 77
Loading
Loading
Loading
Question Protected by CommunityBot
deleted 17 characters in body
Source Link
Cristian
  • 200.4k
  • 63
  • 360
  • 265
Loading
Source Link
Mark
  • 39.9k
  • 15
  • 43
  • 48
Loading