Hi ,
What is the difference between an anonymous function and lambda function in terms of creating instances .
Use Case:
Calling below methods from different activities and the livedata (OnInitSuccess) is Publicly accessible
Anonymous:
OnInitSuccess.observe(this, Observer { "test data".printIt() })
Lambda :
OnInitSuccess.observe(this) {
"test data ".printIt() }
( The app crashes when we try with lambda function, I tried finding the solution in docs and in tutorials but couldn't find any ,
Here is the exception:
java.lang.IllegalArgumentException: Cannot add the same observer with different lifecycles )