I am trying to bind a method inside layout file something like @{viewmodel.setPrintdata()}
but it is not working unless i use @{()->viewmodel.setPrintdata()}
but i came to know that lambda expression is not working on all version of android. What i should do?
Asked
Active
Viewed 50 times
1 Answers
0
Lambda expressions are not associated with any of the android version instead it is the feature of Java 8. If you are using Java 8 in your code it will work on all devices.
Hope you get the point.

Nouman Ch
- 4,023
- 4
- 29
- 42
-
@nauman you should see https://stackoverflow.com/questions/35106196/does-android-sdk-with-api-23-marshmallow-supports-java-8 – Rafa Jan 15 '20 at 05:58
-
you are reviewing very old thread. See this https://stackoverflow.com/questions/23318109/is-it-possible-to-use-java-8-for-android-development – Nouman Ch Jan 15 '20 at 06:01
-
@nauman thanks.. but one more doubt if you can make clear to me .. can i use stream api also? – Rafa Jan 15 '20 at 06:07
-
if you are using java8 then yes you can use java stream api. – Nouman Ch Jan 15 '20 at 06:10
-
@nauman this official link states that i can use Stream API when minsdkversion is 24. https://developer.android.com/studio/write/java8-support.html#supported_features could you confirm please. – Rafa Jan 15 '20 at 08:40