• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Preference Fragment Issue

Muqali

Lurker
Hello all, going through Bucky's tutorial and it is a bit outdated, I've been able to figure out most issues but am running into a brick wall with the idea of the preference fragment. My program is crashing every time I click on preferences. Here is my code

Prefs.java:
Code:
package com.example.testapp;

public class Prefs extends PreferenceFragment {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        addPreferencesFromResource(R.xml.prefs);
    }
}

prefs.xml:
Code:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android" >

    <EditTextPreference
        android:key="name"
        android:summary="Enter Your Name"
        android:title="EditText" />

</PreferenceScreen>

Inside my Menu.java I have:
Code:
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {


	        Intent p = new Intent("com.example.testapp.PREFS");
		startActivity(p);


		return false;
	}

Any ideas?

Thanks!
 
Back
Top Bottom