Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 package eu.intermodalics.tango_ros_streamer.android;
00018
00019 import android.content.Context;
00020 import android.preference.ListPreference;
00021 import android.util.AttributeSet;
00022
00023 import java.util.ArrayList;
00024 import java.util.Map;
00025
00026
00027 public class MapChooserPreference extends ListPreference {
00028 private static final String TAG = MapChooserPreference.class.getSimpleName();
00029
00030 public MapChooserPreference (Context context, AttributeSet attrs) {
00031 super(context, attrs);
00032 setValueIndex(0);
00033 }
00034
00035 public MapChooserPreference (Context context) {
00036 this(context, null);
00037 }
00038
00039 public void setMapList(Map<String, String> uuidNameMap) {
00040 if (uuidNameMap != null) {
00041 ArrayList<String> uuids = new ArrayList<String>();
00042 ArrayList<String> names = new ArrayList<String>();
00043 for (String uuid : uuidNameMap.keySet()) {
00044 uuids.add(uuid);
00045 names.add(uuidNameMap.get(uuid));
00046 }
00047 setEntries(names.toArray(new CharSequence[names.size()]));
00048 setEntryValues(uuids.toArray(new CharSequence[uuids.size()]));
00049 }
00050 }
00051 }