Buggy code:
public class LiquorDetailFragment extends Fragment implements AbsListView . OnScrollListener { private static final int HEADERVIEWS_COUNT = 1 ; private static final long ANIM_IMAGE_ENTER_DURATION = 500 ; private static final long ANIM_TEXT_ENTER_DURATION = 500 ; private static final long ANIM_IMAGE_ENTER_STARTDELAY = 300 ; private static final long ANIM_COLORBOX_ENTER_DURATION = 200 ; private static final TimeInterpolator sDecelerator = new DecelerateInterpolator ( ) ; private static final String ARG_LIQUOR = "liquor" ; private static final String STATE_LIQUOR = "liquor" ; private static final String STATE_DRINKS = "drinks" ; private static final String PREF_DRINKS_JSON = "drinks_json" ; @ InjectView ( id . image ) ImageView mImageView ; @ InjectView ( id . image_blurred ) ImageView mBlurredImageView ; @ InjectView ( id . history ) TextView mHistoryView ; @ InjectView ( id . progressbar ) ProgressBar mProgressBar ; @ InjectView ( id . wikipedia ) Button mWikipediaButton ; @ InjectView ( id . drinks_title ) TextView mDrinksTitleView ; @ InjectView ( id . colorbox ) View mColorBox ; @ InjectView ( id . color1 ) View mColorView1 ; @ InjectView ( id . color2 ) View mColorView2 ; @ InjectView ( id . color3 ) View mColorView3 ; @ InjectView ( id . color4 ) View mColorView4 ; private ListView mListView ; private View mHeaderView ; private Toolbar mToolbar ; private Target mTarget = new Target ( ) { @ Override public void onBitmapLoaded ( Bitmap bitmap , Picasso . LoadedFrom from ) { } @ Override public void onBitmapFailed ( Drawable errorDrawable ) { } @ Override public void onPrepareLoad ( Drawable placeHolderDrawable ) { } } ; private LiquorDetailAdapter mDrinkAdapter ; private DrinksOnScrollListener mAnimationOnScrollListener ; private Liquor mLiquor ; private int mImageViewHeight ; private Callback < List < Drink > > mDrinksCallback = new Callback < List < Drink > > ( ) { @ Override public void success ( List < Drink > drinks , Response response ) { } @ Override public void failure ( RetrofitError error ) { } } ; public static LiquorDetailFragment newInstance ( Liquor liquor ) { } @ Override public View onCreateView ( LayoutInflater inflater , ViewGroup container , Bundle savedInstanceState ) { mToolbar = ( ( fr . masciulli . drinks . activity . ToolbarActivity ) ( getActivity ( ) ) ) . getToolbar ( ) ; mToolbar . getBackground ( ) . setAlpha ( 0 ) ; View root = inflater . inflate ( fragment_liquor_detail , container , false ) ; setHasOptionsMenu ( true ) ; <START_BUG> mHeaderView = inflater . inflate ( header_liquor_detail , null ) ; <END_BUG> mListView = ButterKnife . findById ( root , list ) ; mListView . addHeaderView ( mHeaderView ) ; ButterKnife . inject ( this , root ) ; mDrinkAdapter = new LiquorDetailAdapter ( getActivity ( ) ) ; mListView . setAdapter ( mDrinkAdapter ) ; mLiquor = getArguments ( ) . getParcelable ( LiquorDetailFragment . ARG_LIQUOR ) ; getActivity ( ) . setTitle ( mLiquor . name ) ; Picasso . with ( getActivity ( ) ) . load ( mLiquor . imageUrl ) . into ( mTarget ) ; Transformation transformation = new fr . masciulli . drinks . view . BlurTransformation ( getActivity ( ) , getResources ( ) . getInteger ( blur_radius ) ) ; Picasso . with ( getActivity ( ) ) . load ( mLiquor . imageUrl ) . transform ( transformation ) . into ( mBlurredImageView ) ; mImageViewHeight = ( ( int ) ( getResources ( ) . getDimension ( liquor_detail_recipe_margin ) ) ) ; mListView . setOnScrollListener ( this ) ; mAnimationOnScrollListener = new DrinksOnScrollListener ( mListView ) ; if ( savedInstanceState != null ) { mColorBox . setAlpha ( 1 ) ; Liquor liquor = savedInstanceState . getParcelable ( LiquorDetailFragment . STATE_LIQUOR ) ; List < Drink > drinks = savedInstanceState . getParcelableArrayList ( LiquorDetailFragment . STATE_DRINKS ) ; if ( ( liquor != null ) && ( drinks != null ) ) { onLiquorFound ( mLiquor ) ; mDrinksCallback . success ( drinks , null ) ; } else { refresh ( mLiquor ) ; } } else { ViewTreeObserver observer = mImageView . getViewTreeObserver ( ) ; if ( observer != null ) { observer . addOnPreDrawListener ( new ViewTreeObserver . OnPreDrawListener ( ) { @ Override public boolean onPreDraw ( ) { mImageView . getViewTreeObserver ( ) . removeOnPreDrawListener ( this ) ; runEnterAnimation ( ) ; return true ; } } ) ; } else { refresh ( mLiquor ) ; } } return root ; } @ SuppressWarnings ( "unused" ) @ OnClick ( id . wikipedia ) void goToWikipedia ( ) { } @ SuppressWarnings ( "unused" ) @ OnItemClick ( id . list ) void openRelatedDrinkDetail ( int position , View view ) { } private void runEnterAnimation ( ) { } public void onLiquorFound ( Liquor liquor ) { } public void refresh ( Liquor liquor ) { } @ Override public void onCreateOptionsMenu ( Menu menu , MenuInflater inflater ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } @ Override public void onScrollStateChanged ( AbsListView listView , int state ) { } @ Override public void onScroll ( AbsListView view , int firstVisibleItem , int visibleItemCount , int totalItemCount ) { } @ Override public void onSaveInstanceState ( Bundle outState ) { } private class QuantizeBitmapTask extends AsyncTask < Bitmap , Void , ArrayList < Integer > > { @ Override protected ArrayList < Integer > doInBackground ( Bitmap ... bitmaps ) { } @ Override protected void onPostExecute ( ArrayList < Integer > colors ) { } } }

Fix:
mHeaderView = inflater . inflate ( header_liquor_detail , mListView , false ) ;