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! While you're at it, check out some resources Treehouse students have shared here.

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

Daniel Evans
Daniel Evans
5,105 Points

Why is Auto Import in Android Studio not working?

I'm watching "Accessing Views in Code: Declaring Variables" and I encounter the red colored text, but when I hit Alt+Enter it only brings up a drop down menu. How do I get it to auto import instead?

I'm using Android Studio 1.5.1 , and I've tried changing the java import settings but its not working.

Thank you

1 Answer

Seth Kroger
Seth Kroger
56,413 Points

The class name by itself isn't necessary unique. Auto-import will give you a drop-down when there's more that one class with that name, listing which package each possibility comes from. It's up to you to choose the appropriate one. Given the video you most likely want the package android.widget or android.view.

Daniel Evans
Daniel Evans
5,105 Points

Thanks, I actually just edited the settings under general > import. Do you mind me asking, is this ever a problem?