Code example for GridView

Methods: setAdapter, setOnItemClickListener

0
	} 
 
	public void addMenu() { 
		List<Map<String, Object>> items = items();
		SimpleAdapter adapter = createAdapter(items);
		gridView.setAdapter(adapter);
		MenuListener menuListener = new MenuListener(context, handler, dialog);
		gridView.setOnItemClickListener(menuListener);
	} 
 
	public SimpleAdapter createAdapter(List<Map<String, Object>> items) {
 
		SimpleAdapter adapter = new SimpleAdapter(context, items,
				R.layout.menu_item, new String[] { "icon" },
				new int[] { R.id.ItemImage }); 
		return adapter;
	} 
 
	public List<Map<String, Object>> items() {
 
		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();