In ListPreference android:summary setzen

  • 2 Antworten
  • Neuester Beitrag
Diskutiere In ListPreference android:summary setzen im Android App Entwicklung im Bereich Betriebssysteme & Apps.
M

muck

Ambitioniertes Mitglied
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ß
 
M

muck

Ambitioniertes Mitglied
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]
 
M

mr.freeze

Ambitioniertes Mitglied
ich finde man sollte immer seine lösung angeben.

Gruß