In ListPreference android:summary setzen

  • 2 Antworten
  • Letztes Antwortdatum
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

M
Antworten
21
Aufrufe
1.279
swa00
swa00
Mr-Fisch
Antworten
5
Aufrufe
937
migi01
migi01
Mr-Fisch
Antworten
8
Aufrufe
985
Mr-Fisch
Mr-Fisch
M
Antworten
9
Aufrufe
769
mkuz24
M
A
Antworten
5
Aufrufe
679
swa00
swa00
Zurück
Oben Unten