---
title: "Stop EditText from gaining focus at Activity startup"  
description: "Stop EditText from gaining focus at Activity startup"  
author: "Samuel Fernandes"  
published: 2015-04-23  
updated: 2015-04-23  
canonical: https://www.mindstick.com/forum/23120/stop-edittext-from-gaining-focus-at-activity-startup  
category: "android"  
tags: ["android", "android edittext"]  
reading_time: 1 minute  

---

# Stop EditText from gaining focus at Activity startup

I have an [Android](https://www.mindstick.com/articles/13046/10-reasons-why-i-prefer-android-vs-iphone-ios) [Activity](https://www.mindstick.com/forum/12894/how-to-force-recreation-of-activity-fragment-on-restore), with two [elements](https://www.mindstick.com/forum/1440/wpf-button-with-multiple-text-elements):\
1.EditText2.ListView\
When my Activity starts, the EditText immediately has [input](https://www.mindstick.com/forum/159209/how-can-i-read-convert-an-input-stream-into-a-string-in-java) [focus](https://yourviews.mindstick.com/audio/1251/how-music-can-improve-your-focus-and-mood) (flashing [cursor](https://www.mindstick.com/articles/13003/create-a-simple-cursor-in-sql-server)). I don't want any [control](https://www.mindstick.com/blog/197/asp-dot-net-repeater-control) to have input focus at startup. I tried:\
EditText.setSelected(false);\
No luck. How can I convince the EditText to not [select](https://www.mindstick.com/forum/160534/orderby-then-select-vs-select-then-orderby-performance) itself when the Activity starts?

## Replies

### Reply by Anonymous User

```
<!-- Dummy item to prevent AutoCompleteTextView from receiving focus --><LinearLayout    android:focusable="true" android:focusableInTouchMode="true"    android:layout_width="0px" android:layout_height="0px"/><!-- :nextFocusUp and :nextFocusLeft have been set to the id of this component     to prevent the dummy from receiving focus again --><AutoCompleteTextView android:id="@+id/autotext"    android:layout_width="fill_parent" android:layout_height="wrap_content"    android:nextFocusUp="@id/autotext" android:nextFocusLeft="@id/autotext"/>
```


---

Original Source: https://www.mindstick.com/forum/23120/stop-edittext-from-gaining-focus-at-activity-startup

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
