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 ,
- you can keep flag in shared preferences "tabledcleared" .
- once user click on sign out, update value 0, , start clear tables. if tables clearing completed, update value 1.
- if clearing interrupted, value remain 0
- on next loading check value. if 0, clear tables again before re-loading new values.
Comments
Post a Comment