Code example for GridView

Methods: setAdapter, setOnItemClickListener

0
		if (DEBUG) {
			Shared.p(TAG, "onCreateView(), start");
		} 
		super.onCreate(savedInstanceState);
 
		GridView gridview = new GridView(this.getActivity());
		gridview.setAdapter(new ImageAdapter(this.getActivity()));
 
		gridview.setOnItemClickListener(new OnItemClickListener() {
			public void onItemClick(AdapterView<?> parent, View v,
					int position, long id) {
				Toast.makeText(WidgetMenuGrid.this.getActivity(),
						"" + position, Toast.LENGTH_SHORT).show();
			} 
		}); 
		if (DEBUG) {
			Shared.p(TAG, "onCreateView(), end");
		} 
		return gridview;
	}