2014-01-13 45 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和文件..