package com.lgvalle.material_animations; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.graphics.drawable.DrawableCompat; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; public class SharedElementFragment2 extends Fragment { private static final String EXTRA_SAMPLE = "sample"; public static SharedElementFragment2 newInstance(Sample sample) { Bundle args = new Bundle(); args.putSerializable(EXTRA_SAMPLE, sample); SharedElementFragment2 fragment = new SharedElementFragment2(); fragment.setArguments(args); return fragment; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.activity_sharedelement_fragment2, container, false); Sample sample = (Sample) getArguments().getSerializable(EXTRA_SAMPLE); ImageView squareBlue = (ImageView) view.findViewById(R.id.square_blue); DrawableCompat.setTint(squareBlue.getDrawable(), sample.color); return view; } }