Muhammad chhota
Muhammad chhota

Reputation: 1927

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?

Upvotes: 5

Views: 2149

Answers (2)

azizbekian
azizbekian

Reputation: 62189

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.

Upvotes: 7

mt0s
mt0s

Reputation: 5821

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

Upvotes: 1

Related Questions