Hello i have a xml file which doesent seem to work, i am trying to reach it with a listpreference.
Here is the listpreference code:
<PreferenceCategory android:name="@string/yo_category">
<ListPreference
android:title="YOYO"
android:key="YOYOYO"
android:summary="YODOBO"
android:entries="@+arrays/yoyo"
android:entryValues="@+arrays/yoyoValues"
></ListPreference>
</PreferenceCategory>
And here is the xml file:
<string-array name="yoyo">
<item>1 yoyo</item>
<item>2 yoyos</item>
<item>3 yoyos</item>
</string-array>
<string-array name="yoyoValues">
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
PreferenceActivity class:
public class PreferenceHandler extends PreferenceActivity
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
getFragmentManager().beginTransaction().replace(android.R.id.content, new PrefFragment()).commit();
}
public static class PrefFragment extends PreferenceFragment
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
}
}
} And i cannot seem to find the issue here, i get no errors in eclipse but when i try to run it i cant see the items in the listpreference.
Thanks for any help!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire