Code example for GridView

Methods: setAdaptersetNumColumns

0
		ad = new AlertDialog.Builder(this).setView(getIconsView()).create();
		ad.show();
	} 
	 
	private View getIconsView() {
		GridView v = new GridView(this);
		v.setNumColumns(3);
		v.setAdapter(new IconAdapter(this));
		return v;
	} 
 
	protected void setIcon(int ico) {
		icon = ico;
		((ImageButton)findViewById(R.id.icon)).setImageDrawable(getResources().getDrawable(icon));
		ad.dismiss();
	} 
 
	@Override 
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if(keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_HOME) {
			ContentValues values = new ContentValues();