开发者

Issues resolving xml for preferences screen

Ok, I feel slightly stupid. I am getting the following error:

xml cannot be resolved or is not a field

right at this line:

public class Preferences extends PreferenceActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInsta开发者_开发问答nceState);
            addPreferencesFromResource(R.xml.preferences); <--- this line has error

Can anyone tell me what I am doing wrong? Very frustrating for a new person like myself :(

EDIT: i have a file named preferences.xml located in a folder named xml under res.


Looks like I forgot to include the string in the strings.xml file which i called from the manifest.

<activity android:name=".Preferences"
    android:label="@string/set_preferences"> </activity>

needed to add

<string name="set_preferences">set_preferences</string> to strings.xml
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜