Clear Data From Cache Using Greendao
In my app, there are 4 Activities starting from activities 1 to 4. Database creation takes place in activity1 and values are updated in activities 2, activities 3 etc.But when i m
Solution 1:
You can do it with 2 approaches.
1. startActivityForResult()
approach
Follow the following steps. If confused, you may check this tutorial.
- start your 2nd
Activity
usingstartActivityForResult()
Override
theonActivityResult()
in the 1stActivity
. There, clear the DB cache and refetch the data.- before
finish()
call in 2ndActivity
, callsetResult()
.
2. onResume()
approach
Solution 2:
Simple Solution is
1:Just moves from one next activity to the previous activity using Intent(Not through finish() )
It clears old cache and loads the updated value..
Hope this helps somebody.. :)
Post a Comment for "Clear Data From Cache Using Greendao"