Skip to content
This repository was archived by the owner on Mar 1, 2022. It is now read-only.
This repository was archived by the owner on Mar 1, 2022. It is now read-only.

Value can't be saved when put value after clear() and kill app in background. #106

@IBeiBei

Description

@IBeiBei

Demo project - MainActivity:
@debuglog
public void onGetButtonClick(View v) {
final String value = getSharedPref().getString(MainActivity.KEY, null);
toast(MainActivity.KEY + "'s, value= " + value);
}
@debuglog
public void onSetButtonClick(View v) {
getSharedPref().edit().clear().commit();// Add this line
getSharedPref().edit().putString(MainActivity.KEY, MainActivity.VALUE)
.commit();
toast(MainActivity.KEY + " with enc value:" + MainActivity.VALUE
+ ". Saved");
}
Then Kill app and relaunch, Click 'GET FOO' value =null. value should be 'Bar'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions