This question already has an answer here:
- Is it possible to use Java 8 for Android development? 21 answers
Happy to know that java introduced Lambda expressions in java version 8.
I was working in android studio. And I noticed that DialogInterface.OnClickListener()
was showing underline and became grey colored as below:
So, I did alter + enter
on that line and found option to replace the code with Lambda Expressions, as below:
Which resulted in something below:
After running the code it showed me this error:
Error:(160, 69) error: lambda expressions are not supported in -source 1.7 (use -source 8 or higher to enable lambda expressions)
But I am already using java jdk1.8.0_31
. Is there anything else, I need to install ?
Can anyone help me out please..