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
精彩评论