Buggy code:
public class AddItemActivity extends ActionBarActivity { protected static final String TAG = "AddActivity" ; protected static String mItemType ; protected static ArrayList < TripBookItem > selectedItems ; protected static HorizontalListFragment fragmentFriends ; protected static HorizontalListFragment fragmentImages ; protected static HorizontalListFragment fragmentPlace ; protected static HorizontalListFragment fragmentTrip ; static DateFormat dateFormat ; private final int SELECT_PHOTO = 1 ; protected ImageView mMainImage ; protected TripBookItem mTripbookItem ; protected EditText mTripName ; protected TextView mStartDatePicker ; protected TextView mEndDatePicker ; protected EditText mNotes ; protected TextView mCurrentDate ; protected boolean isDirty = false ; private TextWatcher textWatcher = new TextWatcher ( ) { @ Override public void afterTextChanged ( Editable s ) { } @ Override public void beforeTextChanged ( CharSequence s , int start , int count , int after ) { } @ Override public void onTextChanged ( CharSequence s , int start , int before , int count ) { } } ; private String mImageFilePath ; private OnTouchListener dateOnTouchListener = new View . OnTouchListener ( ) { @ Override public boolean onTouch ( View view , MotionEvent motionEvent ) { } } ; @ Override protected void onActivityResult ( int requestCode , int resultCode , Intent imageReturnedIntent ) { } @ Override public void onDestroy ( ) { } @ Override public void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; setContentView ( activity_add ) ; mTripName = ( ( EditText ) ( findViewById ( trip_add_name ) ) ) ; mTripName . addTextChangedListener ( textWatcher ) ; mTripName . setHint ( hint_trip_name ) ; AddItemActivity . dateFormat = android . text . format . DateFormat . getMediumDateFormat ( this ) ; mStartDatePicker = ( ( TextView ) ( findViewById ( trip_add_start ) ) ) ; mStartDatePicker . setText ( AddItemActivity . dateFormat . format ( new Date ( ) ) ) ; mStartDatePicker . setOnTouchListener ( dateOnTouchListener ) ; mEndDatePicker = ( ( TextView ) ( findViewById ( trip_add_end ) ) ) ; mEndDatePicker . setText ( AddItemActivity . dateFormat . format ( new Date ( ) ) ) ; mEndDatePicker . setOnTouchListener ( dateOnTouchListener ) ; mNotes = ( ( EditText ) ( findViewById ( trip_add_notes ) ) ) ; mNotes . addTextChangedListener ( textWatcher ) ; mCurrentDate = mStartDatePicker ; mMainImage = ( ( ImageView ) ( findViewById ( trip_add_main_image ) ) ) ; mMainImage . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View view ) { Intent photoPickerIntent = new Intent ( Intent . ACTION_PICK ) ; photoPickerIntent . setType ( "image//*" ) ; startActivityForResult ( photoPickerIntent , SELECT_PHOTO ) ; } } ) ; if ( ( getIntent ( ) . getExtras ( ) ) != null ) { if ( getIntent ( ) . getExtras ( ) . containsKey ( "itemKey" ) ) { long itemKey = getIntent ( ) . getExtras ( ) . getLong ( "itemKey" ) ; mTripbookItem = new TripBookItemData ( this ) . getItem ( itemKey ) ; mTripName . setText ( mTripbookItem . getTitle ( ) ) ; mStartDatePicker . setText ( mTripbookItem . getCreatedAt ( ) ) ; mEndDatePicker . setText ( mTripbookItem . getEndDate ( ) ) ; mNotes . setText ( mTripbookItem . getDescription ( ) ) ; ImageWrapper . loadImageFromFile ( this , mMainImage , mTripbookItem . getThumbnail ( ) , 400 ) ; } if ( getIntent ( ) . getExtras ( ) . containsKey ( "itemType" ) ) { AddItemActivity . mItemType = getIntent ( ) . getExtras ( ) . getString ( "itemType" ) ; } else { AddItemActivity . mItemType = TripBookItem . TYPE_TRIP ; } } AddItemActivity . selectedItems = new ArrayList ( ) ; AddItemActivity . fragmentFriends = new HorizontalListFragment ( ) ; AddItemActivity . fragmentPlace = new HorizontalListFragment ( ) ; AddItemActivity . fragmentImages = new HorizontalListFragment ( ) ; if ( AddItemActivity . mItemType . equals ( TYPE_TRIP ) ) { replaceListFragment ( AddItemActivity . fragmentFriends , trip_view_friends , TYPE_FRIENDS ) ; replaceListFragment ( AddItemActivity . fragmentPlace , trip_view_places , TYPE_PLACE ) ; replaceListFragment ( AddItemActivity . fragmentImages , trip_view_gallery , TYPE_GALLERY ) ; } else if ( AddItemActivity . mItemType . equals ( TYPE_PLACE ) ) { replaceListFragment ( AddItemActivity . fragmentPlace , trip_view_places , TYPE_TRIP ) ; replaceListFragment ( AddItemActivity . fragmentFriends , trip_view_friends , TYPE_FRIENDS ) ; replaceListFragment ( AddItemActivity . fragmentImages , trip_view_gallery , TYPE_GALLERY ) ; } else if ( AddItemActivity . mItemType . equals ( TYPE_FRIENDS ) ) { replaceListFragment ( AddItemActivity . fragmentPlace , trip_view_places , TYPE_TRIP ) ; <START_BUG> replaceListFragment ( AddItemActivity . fragmentPlace , trip_view_friends , TYPE_PLACE ) ; <END_BUG> replaceListFragment ( AddItemActivity . fragmentImages , trip_view_gallery , TYPE_GALLERY ) ; } isDirty = false ; } private void replaceListFragment ( HorizontalListFragment fragment , int horizontalList , String itemType ) { } @ Override public boolean onCreateOptionsMenu ( Menu menu ) { } public void cancelAction ( View view ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } private void saveItem ( ) { } private boolean validate ( ) { } protected void showToast ( String text ) { } public void showTimePickerDialog ( View v ) { } public void showDatePickerDialog ( View v ) { } public static class TimePickerFragment extends DialogFragment implements TimePickerDialog . OnTimeSetListener { @ Override public Dialog onCreateDialog ( Bundle savedInstanceState ) { } public void onTimeSet ( TimePicker view , int hourOfDay , int minute ) { } } public static class DatePickerFragment extends DialogFragment implements DatePickerDialog . OnDateSetListener { @ Override public Dialog onCreateDialog ( Bundle savedInstanceState ) { } public void onDateSet ( DatePicker view , int year , int month , int day ) { } } }

Fix:
replaceListFragment ( AddItemActivity . fragmentFriends , trip_view_friends , TYPE_PLACE ) ;