2014-04-13 54 views
0

我有下面的代碼MainActivity:即使在全新安裝之後,我的sharedPreferences如何包含我的密鑰?

private String getSecurityTokenFromSP() { 
    SharedPreferences prefs = this.getSharedPreferences(
      PublicMacros.SP_NAME, Context.MODE_PRIVATE); 

    return prefs.getString(PublicMacros.authToken, ""); 
} 

怎麼來的,它總是返回非null值之後,即使重新安裝?

在我的應用程序入口點的MainActivity中,沒有任何事情發生過。

+2

您的默認值是'「」'它不是null。它是一個空字符串 – Raghunandan

回答

相關問題