Code example for ListFragment

Methods: getActivity, onContextItemSelected, setListAdapter

0
			mDbHelper.updateWebcam(id, newName);
 
			webcamCursor = mDbHelper.fetchAllWebcam();
 
			SimpleCursorAdapter adapter = new SimpleCursorAdapter(
					getActivity(), android.R.layout.simple_list_item_1,
					webcamCursor, new String[] { "City" },
					new int[] { android.R.id.text1 });
 
			this.setListAdapter(adapter);
			return super.onContextItemSelected(item);
 
		} 
 
		@Override 
		public void onListItemClick(ListView l, View v, int position, long id) {
			// Insert desired behavior here. 
			Log.i("FragmentComplexList", "Item clicked: " + id);
			webcamCursor.moveToPosition(position);
			char cat = webcamCursor.getString(
					webcamCursor.getColumnIndex("Cat")).charAt(0);