I am trying to make a preferences activity in android. What happens is you start the app and the you press the menu or settings button on your phone while in the app. Preferences should be on of the categories you can chose from. the problem is when I tap preferences the application crashes. Can someon please fix and repaste my code.
import android.os.Bundle;
import android.preference.PreferenceActivity;
public class Prefs extends PreferenceActivity{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.prefs);
}
}
I am aware I am using a deprecated method, I tried going to the android.developers website and I couldnt find an answer
Here is my XML:
<EditTextPreference
android:title="EditText"
android:key="name"
android:summary="Enter Your Name"
/>
<CheckBoxPreference
android:title="CheckBox"
android:defaultValue="true"
android:key="checkbox"
android:summary="check this box"
/>
<ListPreference
android:title="list"
android:key="list"
android:summary="This is a list to choose from"
android:entries="@+array/list"
android:entryValues="@+array/lvalues"
></ListPreference>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.