I'm still new in Android programming, and I just can't solve this problem. I'm creating a Preference Screen, but at the moment I run the application, I get the following error:
Error:Execution failed for task ':app:mergeDebugResources'.
> Unsupported type 'PreferenceScreen' in file C:\Users\Fidel Sebastián\AndroidStudioProjects\Asteroides\app\src\main\res\values\preferencias.xml
This is the XML file:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:key="preferencias_principal" >
<CheckBoxPreference
android:key="music"
android:title="Start music"
android:summary="Select for background music"/>
<ListPreference
android:key="graphics"
android:title="Graphics type"
android:summary="Choose your graphics type"
android:entries="@array/graphicstype"
android:entryValues="@array/graphicsTypeValues"
android:defaultValue="1"/>
<EditTextPreference
android:key="fragments"
android:title="Number of fragments"
android:summary="Select for meteor fragments"
android:defaultValue="3"/>
</PreferenceScreen>
</resources>
This is the Java file:
package com.example.fidelsebastin.asteroides;
import android.os.Bundle;
import android.preference.PreferenceFragment;
public class Preferences extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.arrays);
}
}
I've searched all over the Web, but I still can't find the answer. Any help would be really appreciated. Thanks in advance.