如何prevent共享preferance被明确设定 [英] How to prevent a shared preferance from being clear in setting
问题描述
我不想让设置清除我的应用程序共享preference
被任何人:?是否有可能
I don't want to let Settings clear my app sharedPreference
by anyone: is it possible?
推荐答案
嘿,哥们我找到了答案在这里是一种方法,prevent数据共享preference被清除
hey buddy i found an answer here is a way to prevent data being cleared from Shared Preference
添加安卓manageSpaceActivity =。ActivityOfMyChoice
到应用程序
标记您的清单,如:
Add android:manageSpaceActivity=".ActivityOfMyChoice"
to the application
tag of your Manifest like:
<application android:label="MyApp" android:icon="@drawable/icon"
android:manageSpaceActivity=".ActivityOfMyChoice">
而不是清除数据
然后,有一个管理空间
这将启动<$按钮C $ C> ActivityOfMyChoice
Then instead of "Clear Data"
, there is a button for "Manage Space"
which launches ActivityOfMyChoice
它会调用我的活动,该活动结束在创作,我喜欢这个招数....:)
it will call my activity and the Activity is finish at creation, I love this tricks.... :)
public class ActivityOfMyChoice extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
finish();
}
}
现在你可以preSS管理空间就像你想要的! :)
Now you can press the "Manage space" as much as you want! :)
该方法适用的时间100%。
this method works 100% of the time.
这篇关于如何prevent共享preferance被明确设定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!