package com.example.listvie;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.app.Activity;
import android.view.ActionMode;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
public class simple extends Activity{
private ListView listView;
private SimpleAdapter simple;
// private String []from = {"tv","img"};
// private int [] to = {R.id.tv,R.id.img};
private List<Map<String,Object>>DataList;
@Override
public void onActionModeFinished(ActionMode mode) {
super.onActionModeFinished(mode);
setContentView(R.layout.main);
listView = (ListView) findViewById(R.id.listView1);
DataList = new ArrayList<Map<String,Object>>();
simple = new SimpleAdapter(this, getDataList(), R.layout.view, new String[]{"tv","img"}, new int []{R.id.tv,R.id.img});
listView.setAdapter(simple);
}
private List<Map<String,Object>> getDataList() {
for(int i=0;i<20;i++){
Map<String,Object>map = new HashMap<String,Object>();
map.put("tv", "0.0+i");
map.put("img",R.drawable.ic_launcher);
DataList.add(map);
}
return DataList;
}
}