Code example for ListFragment

Methods: getActivity, onViewCreated, setListAdapter

0
public class PhotoFragment extends ListFragment {
	ArrayAdapter<String> adapter;
 
	@Override 
	public void onViewCreated(View view, Bundle savedInstanceState) {
		super.onViewCreated(view, savedInstanceState);
		adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, new String[] { "Gallery+Point", "Viewpager+Fragment+Indicator" });
		setListAdapter(adapter);
	} 
	@Override 
	public void onListItemClick(ListView l, View v, int position, long id) {
		super.onListItemClick(l, v, position, id);
		startActivity(new Intent(getActivity(), PhotoActivity.class).putExtra("type", position));
	} 
}