public class Chan_List extends ListActivity {
private ScanActivity sActivity = null;
private static final String TAG = "RCU";
private SimpleAdapter listAdapter = null;
private MobileControl mControl=null;
private ListView show;
private List<Map<String, Object>>chanlist=new ArrayList<Map<String, Object>>();
Map<String, Object> map;
public Chan_List() {
// TODO Auto-generated constructor stub
}
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
mControl = (MobileControl) getApplicationContext();
setContentView(R.layout.chan_list);
map=new HashMap<String, Object>();
map.put("chan_index", "1.");
map.put("chan_name", "CCTV10");
chanlist.add(map);
listAdapter = new SimpleAdapter(Chan_List.this, chanlist,
R.layout.chanlist, new String[] { "chan_index",
"chan_name" }, new int[] {
R.id.chan_index, R.id.chan_name });
setListAdapter(listAdapter);
show= new ListView(this);
registerForContextMenu(show);
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
// TODO Auto-generated method stub
super.onCreateContextMenu(menu, v, menuInfo);
menu.add(0,0,0,"sort");
menu.add(0,1,0,"delate");
menu.add(0,2,0,"move");
}
@Override
public boolean onContextItemSelected(MenuItem item){
AdapterView.AdapterContextMenuInfo info =(AdapterView.AdapterContextMenuInfo)item.getMenuInfo();
switch (item.getItemId()) {
case 0:
Toast.makeText(Chan_List.this, "he", Toast.LENGTH_SHORT).show();
break;
default:
break;
}
return super.onContextItemSelected(item);
}
}