Android: Need an advice with "sign out"-button implementation -


i need advice. need implement "sign out"-button in app. when user presses it, should clean database , open main screen. made drop-recreate of tables in db. found if user clicks sign out while app in process of refreshing data (parsing-saving db) in thread, "sqliteexception: no such table". question is: how implement sign out ? of variants: disable "sign out"-button or not drop tables until data sync completes ? or variants ... ?

i followed mvp pattern during app implementation. so, view (activity/fragment) calls presenter's (it's scoped-singletone provided dagger2) load-method , presenter calls intercator start data sync. great see patterns load data. know prefers use android services...

tia

for idea ,

  1. you can keep flag in shared preferences "tabledcleared" .
  2. once user click on sign out, update value 0, , start clear tables. if tables clearing completed, update value 1.
  3. if clearing interrupted, value remain 0
  4. on next loading check value. if 0, clear tables again before re-loading new values.

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -