1樓:
存到偏好檔案吧
另外你在另乙個答案下說得問題是因為
/*** Returns class name for this activity with the package prefix removed.
* This is the default name used to read and write settings.
** @return The local class name.
*/@NonNull
public
String
getLocalClassName
()return
cls.
substring
(packageLen+1
);}/*** Retrieve a object for accessing preferences
* that are private to this activity. This simply calls the underlying
* method by passing in this activity's
* class name as the preferences name.
** @param mode Operating mode. Use for the default
operation, and
link #MODE_WORLD_WRITEABLE} to control permissions.
** @return Returns the single SharedPreferences instance that can be used
to retrieve and modify the preference values.
*/public
SharedPreferences
getPreferences
(int
mode
)這個偏好檔案是用activity的類名存的,具體如何使用偏好檔案請看文件
儲存到Preference