Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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 />

manually.