how to reset all stored data store using shared preferences

前端 未结 4 1934
孤独总比滥情好
孤独总比滥情好 2021-01-01 15:29

I have created an activity where i have used shared preferences for storing data..now in another activity i have an reset button..when i click on the reset button the data s

4条回答
  •  再見小時候
    2021-01-01 16:07

    Use SharedPreferences.Editor clear() method.

    See Documentation

    SharedPreferences preferences = getPreferences(0);
            SharedPreferences.Editor editor = preferences.edit();
    
            editor.clear();
            editor.commit();
    

提交回复
热议问题