Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从android SharedReference读取_Android_Sharedpreferences_Preferencescreen - Fatal编程技术网

从android SharedReference读取

从android SharedReference读取,android,sharedpreferences,preferencescreen,Android,Sharedpreferences,Preferencescreen,我知道以前有人问过,但对我来说似乎不起作用 我在文件夹res\XML中有一个XML文件preferences.XML。它在屏幕上包含如下选项: <PreferenceScreen> <EditTextPreference android:name="prfEmail" android:summary="Your account's e-mail address" android:

我知道以前有人问过,但对我来说似乎不起作用

我在文件夹
res\XML
中有一个XML文件
preferences.XML
。它在屏幕上包含如下选项:

<PreferenceScreen>
  <EditTextPreference
                android:name="prfEmail"
                android:summary="Your account's e-mail address"
                android:title="E-mail"
                android:key="prfEmail" />
</PreferenceScreen>

我想打印它返回的值
null
。我做错了什么?

应用程序首选项存储在默认的
SharedReferences
中。您可以通过以下方式访问它们:

SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);