Android 如何将对象中的数据输入SimpleAdapter

Android 如何将对象中的数据输入SimpleAdapter,android,listview,android-arrayadapter,simpleadapter,Android,Listview,Android Arrayadapter,Simpleadapter,我想用一些数据填写我的ListView,我使用SimpleAdapter。但我认为SimpleAdapter只适用于List,我有如下代码: 我能做什么? 有办法吗 List<DSarchive> programs = ...; String[] from = new String[] {"name", "time", "day", "month"}; int[] to = new int[] { R.id.text1, R.id.text2, R.id.text3, R.id.te

我想用一些数据填写我的ListView,我使用SimpleAdapter。但我认为SimpleAdapter只适用于List,我有如下代码:

我能做什么? 有办法吗

List<DSarchive> programs = ...;
String[] from = new String[] {"name", "time", "day", "month"};
int[] to = new int[] { R.id.text1, R.id.text2, R.id.text3, R.id.text4};

SimpleAdapter adapter = new SimpleAdapter(getActivity(), programs, R.layout.my_list_row, from, to);
//                                                        ^ how can I use this "programs" List???

lv.setAdapter(adapter);
尝试使用ArrayAdapter

尝试使用ArrayAdapter


这种方法只需在每行中输入一个数据,但我想在每行中输入一些数据。这种方法只需在每行中输入一个数据,但我想在每行中输入一些数据。
public class MyObject{
    public ArrayList<String> links;
    public String name;
    public List<HashMap<String, String>> adapter;
    .
    .
    .
}
ArrayList<String> arrayList = new ArrayList<String>();
arrayList.add("temp1");
arrayList.add("temp2");
ListView listView = new ListView(getActivity());
listView.setAdapter(new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1, arrayList));
List<Map<String, Object>> data = new ArrayList<Map<String,Object>>();

Map<String, Object> dataMap = new HashMap<String, Object>(3);

dataMap.put("Item1", dataObject); //icon
dataMap.put("Item2", dataString);
dataMap.put("Item3", dataString2);
data.add(dataMap);

dataMap = new HashMap<String, Object>(2);
dataMap.put("Item1", dataObject); //icon
dataMap.put("Item2", dataString);
dataMap.put("Item3", dataString2);
data.add(dataMap);

SimpleAdapter adapter = new SimpleAdapter(getActivity().getBaseContext(), 
                                         (List<? extends Map<String, ?>>) data, 
                                         R.layout.layoutFile2, 
                                         new String[] {"Item1", "Item2", "Item3"} , 
                                         new int[] {R.id.item1, R.id.item2, R.id.item3}){

                                         //overload the getChildView or any other Override methods
                                         };