使用共享preferences在xamarin [英] Use Shared Preferences in xamarin
本文介绍了使用共享preferences在xamarin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图挽救字符串值应用程序关闭后,重新打开。
I tried to save string value after the app closed and re open.
我看所有的共享preferences,但如果我需要打开新的活动还是什么我听不懂。
I look at all of the SharedPreferences but i didn't understand if i need to open new activity or what.
所以,如果你有任何想法,这将是非常有益的。
So if you have any idea it will be very helpful.
推荐答案
我recomendo你的是实现共享preferences ......通过这样的方式去
what I recomendo you is to implement shared preferences... going by this way
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences.Editor editor = preferences.edit();
editor.putstring("PreferenceName","YOUR PREFERENCE VALUE");
editor.commit;
,只要你想检查loginMethod值只需要调用这样的preference值...
and whenever you want to check the loginMethod value just call the preference value like this...
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
String myValue= preferences.getString("PreferenceName", "");
如果您需要更多的帮手,我会很乐意帮助你更
if you need more assistant I'll be more than happy to help you
这篇关于使用共享preferences在xamarin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文