In ListPreference android:summary setzen

M

muck

Ambitioniertes Mitglied
7
Hallo zusammen,

ich möchte in den Settings unter android:summary die aktuelle Einsetllung anzeigen. Und ich weiß nicht wie ich da ran komm. Wahrscheinlich ziemlich einfach aber ich sehe es im Moment nicht.

Mein Layout
Code:
<PreferenceScreenxmlns:android="[URL]http://schemas.android.com/apk/res/android[/URL]">
 <PreferenceCategoryandroid:title="@string/app_settings">
  <ListPreference
   android:id="@+id/lpListRotation"
   android:key="list_rotation"
   android:defaultValue="@string/txt_rotation_default"
   android:title="@string/txt_rotation"
   android:entries="@array/rotation_text"
   android:entryValues="@array/rotation_values"
   android:summary="Test"/>
  <ListPreference
   android:id="@+id/lpListShowProducts"
   android:key="list_show_products"
   android:defaultValue="@string/txt_show_products_default"
   android:title="@string/txt_show_products"
   android:entries="@array/show_products_text"
   android:entryValues="@array/show_products_values"
   android:summary="Text"/>
 </PreferenceCategory>
</PreferenceScreen>

Wie kann ich beim öffnen android:summary setzen?
Code:
[LEFT]public class Settings extends PreferenceActivity{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.addPreferencesFromResource(R.xml.settings);
}
public static final SharedPreferences getSettings(final ContextWrapper ctx) {
return ctx.getSharedPreferences(ctx.getPackageName() + "_preferences", MODE_PRIVATE);
}
}[/LEFT]

Im Voraus vielen Dank.
Gruß
 
Vielleicht brauchts mal irgendwann noch jemand:

Code:
[SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0][SIZE=2]ListPreference [/SIZE]et[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = (ListPreference) getPreferenceManager().findPreference([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"list_rotation"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE]
 
[SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]et[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].setSummary("Bla bla");[/SIZE]
 
  • Danke
Reaktionen: mr.freeze
ich finde man sollte immer seine lösung angeben.

Gruß
 

Ähnliche Themen

A
Antworten
1
Aufrufe
633
swa00
swa00
D
Antworten
23
Aufrufe
2.497
Data2006
D
OnkelLon
Antworten
13
Aufrufe
1.972
OnkelLon
OnkelLon
Zurück
Oben Unten