2014-01-13 39 views
0

我很好奇,是否有任何框架模式退出应用程序,由于注销往往作为清理应用程序,并启动它,就像它刚刚安装。Android模式注销

第一个,有清除整个应用程序的任何快捷方式,或者你必须手动清除所有持久数据,如SharedPreferences,数据库,文件?

第二个,有没有标准化的Android注销模式?

回答

1

首先Is there any shortcut for clearing whole app or you have to clear all persistent data like SharedPreferences, database, files manually ? 答:

.clear()函数可用于清除数据。

对于前:

editor.clear(); 
editor.commit(); // Make sure that you need to commit that. 

is there any standardized Android logout pattern ? 答:

有没有需要的那个。您只需使用SharedPreferences即可。

例:

当你需要在那个时候再登录只需保存在SharedPreferences用户的登录凭据文件否则当你需要从文件注销,然后简单地清除这些值。

就是这样。你已准备好出发。

0

不,你必须清除signout按钮的点击您的sharedprefrences和文件..