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.

Cihan Kaptan
2,819 PointsHow to get Android Resources to Main Activity
Resources res = getResources(); final String[] array = res.getStringArray(R.array.facts_array);
This codes is working at Eclipse but Android Studio is giving Error for getResources() method ?

Alexander Schott
8,318 Pointssame problem here, unresolved method. It can't find the getResources() method.
3 Answers

kriz bus
281 PointsCheck the import statement...

Connor Myers
21,089 PointsYou can chain them all together and get rid of the resources variable like this:
String[] array = getResources().getStringArray(R.array.facts_array);
Don't know if this is going to change anything but It will help your code to look a little cleaner :)

Cihan Kaptan
2,819 PointsThere isnt any problem about imports. Everything is same at two tools but Android Studio doesnt let use getResources() method
Leonardo Vidal
14,603 PointsLeonardo Vidal
14,603 Pointswhat is the error?