如何清除数据的编程机器人 [英] How to Clear Data on Android Programmatically
本文介绍了如何清除数据的编程机器人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我开发一个Android应用程序。我需要清除编程包括preferences,当我preSS一个按钮,数据库中的数据。
I am developing an Android App. I need to clear the data programmatically including the preferences and databases when i press a button.
推荐答案
要清除共享prefrences:
To clear the Shared Prefrences :
SharedPreferences settings = getActivity().getSharedPreferences("cda-preferences", Context.MODE_PRIVATE);
settings.edit().clear().commit();
和使用删除查询数据库:)
and use the delete query for the database :)
这篇关于如何清除数据的编程机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文