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 an Interactive Story App (Retired) Intents and Multiple Activities Adding a Second Activity

Aleksander Aleksic
Aleksander Aleksic
7,965 Points


I see you use Lambda in the onClick method, but when i trie to use it i get an compile error. Any idea ?

2 Answers

Seth Kroger
Seth Kroger
56,407 Points

You can't use lambda's in in Android code just yet, since Android only officially supports Java 7, so far, not 8. So you will need to use one of the other methods like an anonymous inner class, etc.

Now Android Studio does do something called "code folding" where it will simplify the display of the code. Things like showing the string used from the string.xml file in place of R.string.whatever. They'll be highlighted but when you click to edit them they show the actual code. One of the "foldings" is to show an 1-method anonymous inner class in lambda notation instead. You can see in the video at 4:20 where Ben explains what AS is doing there.

Please provide your code and the error log.