Buggy code:
public abstract class StickyListFragment extends BaseFragment implements LoaderManager . LoaderCallbacks < Cursor > , AdapterView . OnItemClickListener { public static final String RESULT_EXTRA_ITEM_ID = ( StickyListFragment . class . getName ( ) ) + ".RESULT_EXTRA_ITEM_ID" ; public static final String RESULT_EXTRA_ITEM_IDS = ( StickyListFragment . class . getName ( ) ) + ".RESULT_EXTRA_ITEM_IDS" ; public static final int SELECTION_TYPE_NONE = 0 ; public static final int SELECTION_TYPE_SINGLE = 1 ; public static final int SELECTION_TYPE_MULTI = 2 ; protected static final String ARG_SELECTION_TYPE = "ARG_SELECTION_TYPE" ; protected static final String ARG_ITEM_IDS = "ARG_ITEM_IDS" ; protected static final String ARG_IS_OPEN_DRAWER_LAYOUT = "ARG_IS_OPEN_DRAWER_LAYOUT" ; protected static final String STATE_SELECTED_POSITIONS = "STATE_SELECTED_POSITIONS" ; protected static final int LOADER_ITEMS = 1468 ; protected StickyListHeadersListView list_V ; protected View create_V ; protected AbstractCursorAdapter adapter ; protected int selectionType ; public static Bundle makeArgs ( int selectionType , long [ ] itemIDs ) { } public static Bundle makeArgs ( int selectionType , long [ ] itemIDs , boolean isOpenDrawerLayout ) { } @ Override public void onCreate ( Bundle savedInstanceState ) { } @ Override public View onCreateView ( LayoutInflater inflater , ViewGroup container , Bundle savedInstanceState ) { } @ Override public void onViewCreated ( View view , Bundle savedInstanceState ) { } @ Override public void onActivityCreated ( Bundle savedInstanceState ) { } @ Override public void onSaveInstanceState ( Bundle outState ) { } @ Override public void onCreateOptionsMenu ( Menu menu , MenuInflater inflater ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } @ Override public Loader < Cursor > onCreateLoader ( int id , Bundle bundle ) { } @ Override public void onLoadFinished ( Loader < Cursor > cursorLoader , Cursor cursor ) { } @ Override public void onLoaderReset ( Loader < Cursor > cursorLoader ) { } @ Override public void onItemClick ( AdapterView < ? > adapterView , View view , int position , long id ) { switch ( selectionType ) { case StickyListFragment . SELECTION_TYPE_NONE : <START_BUG> if ( position == ( adapterView . getCount ( ) ) ) <END_BUG> startItemCreate ( getActivity ( ) , view ) ; else startItemDetails ( getActivity ( ) , id , position , adapter , adapter . getCursor ( ) , view ) ; break ; case StickyListFragment . SELECTION_TYPE_SINGLE : final Bundle extras = new Bundle ( ) ; onItemSelected ( id , adapter , adapter . getCursor ( ) , extras ) ; Intent data = new Intent ( ) ; data . putExtra ( StickyListFragment . RESULT_EXTRA_ITEM_ID , id ) ; data . putExtras ( extras ) ; getActivity ( ) . setResult ( RESULT_OK , data ) ; getActivity ( ) . finish ( ) ; break ; case StickyListFragment . SELECTION_TYPE_MULTI : adapter . setSelectedIDs ( list_V . getCheckedItemIds ( ) ) ; break ; } } protected abstract AbstractCursorAdapter createAdapter ( Context context ) { } protected abstract Loader < Cursor > createItemsLoader ( ) { } protected abstract void onItemSelected ( long itemId , AbstractCursorAdapter adapter , Cursor c , Bundle outExtras ) { } protected abstract void startItemDetails ( Context context , long itemId , int position , AbstractCursorAdapter adapter , Cursor c , View view ) { } protected abstract void startItemCreate ( Context context , View view ) { } public long [ ] getSelectedItemIDs ( ) { } protected void bindItems ( Cursor c ) { } No newline ; at end ; of file ; }

Fix:
if ( position == ( adapter . getCount ( ) ) )