How do I refresh my activity after deleting data from database (using DAO)

Wsa :

How should I "refresh" my Activity after tap on button which will delete all records in data base? For now, after tapping on icon which is responsible for deleting data, I have to re-run my app to see changes - such as empty RecyclerView.

Destroyer :

As already indicated, you need to use LiveData or rxJava 2 to update activity every time you change data.

LiveData : https://medium.com/mindorks/using-room-database-with-livedata-android-jetpack-cbf89b677b47

RXJava 2: https://medium.com/androiddevelopers/room-rxjava-acb0cd4f3757

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=237356&siteId=1