Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Self-Destructing Message Android App Starting the App Android Layouts in XML

Shariq Shaikh
Shariq Shaikh
13,945 Points

requestFocus child element not present but the cursor still starts on app launch, does anyone know why?

I'm not having any difficulty running the project, I just would like to know in my version there is no requestForm child but the cursor still starts in the username field on start up, does anyone know why?

PS: I'm running android studio 0.8.9

1 Answer

Boris Vukobrat
Boris Vukobrat
4,248 Points

You mean Android Studio doesn't automatically generate

<requestFocus />

element in LoginActivity's layout file , but anyway you have focus on it when testing app?

That is because focus is set to the first View declared in layout file, in our case it is @+id/usernameField. In other cases, we must set

<requestFocus />