How to delete shared preferences data from App in Android

前端 未结 24 2454
日久生厌
日久生厌 2020-11-22 14:37

How do I delete SharedPreferences data for my application?

I\'m creating an application that uses a lot of web services to sync data. For testing purposes, I need to

24条回答
  •  被撕碎了的回忆
    2020-11-22 15:33

    To remove specific values: SharedPreferences.Editor.remove() followed by a commit()

    To remove them all SharedPreferences.Editor.clear() followed by a commit()

    If you don't care about the return value and you're using this from your application's main thread, consider using apply() instead.

提交回复
热议问题