Android lifecycle library: Cannot add the same observer with different lifecycles

In my case the problem was at lambda method of observer is empty. I just tried to add something to it and problem was solved. For example:

gpsState.observe(this, (state) -> {
                Log.d(this.getClass().getSimpleName(), BaseNavigationActivity.this.toString());

});

Most likely that JVM define anonymous classes that use only static references and for such cases it become kinda singleton, so you will have same instance all the time you reference such class.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)