Code example for ListFragment

Methods: onAttach

0
        outState.putInt("index", index);
    } 
 
    @Override 
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        try { 
            selectedListener = (ListItemSelectedListener) activity;
        } catch (ClassCastException e) {
            throw new ClassCastException(activity.toString()
                    + " must implement ListItemSelectedListener in Activity"); 
        } 
    } 
 
    public interface ListItemSelectedListener { 
        public void onListItemSelected(int index);
    } 
 
    public class ImageAndTextAdapter extends ArrayAdapter<String> {
 
		private LayoutInflater mInflater;