Code example for Fragment

Methods: getArgumentsonCreate

     * Populate image using a url from extras, use the convenience factory method 
     * {@link ImageDetailFragment#newInstance(String)} to create this fragment. 
    public void onCreate(Bundle savedInstanceState) {
        mImageUrl = getArguments() != null ? getArguments().getString(IMAGE_DATA_EXTRA) : null;
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        // Inflate and locate the main ImageView 
        final View v = inflater.inflate(R.layout.image_detail_fragment, container, false);
        mImageView = (ImageView) v.findViewById(;
        return v;
    public void onActivityCreated(Bundle savedInstanceState) {