Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LifecycleRegistryOwner class is deprecated

I am using the Room database from Android architecture component. So for LiveData I am implementing the LifecycleRegistryOwner interface in my activity. As there is alternative solution to use LifeCyceActivity but my activity is already extending BaseActivity so I can't do it.

What is alternative of LifecycleRegistryOwner?

like image 327
Muhammad chhota Avatar asked Sep 18 '17 15:09

Muhammad chhota


2 Answers

As seen in docs

This interface was deprecated in API level 1.0.0.

Use android.support.v7.app.AppCompatActivity which extends LifecycleOwner, so there are no use cases for this class.

Which means, that if your activity is a descendent of AppCompatActivity, than it already implements LifecycleOwner interface.

These changes are introduced in support libs version 26.1.0.

like image 75
azizbekian Avatar answered Nov 02 '22 22:11

azizbekian


From the docs :

This interface was deprecated in API level 1.0.0. Use android.support.v7.app.AppCompatActivity which extends LifecycleOwner, so there are no use cases for this class.

Link here

like image 22
mt0s Avatar answered Nov 02 '22 20:11

mt0s