@Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    logger.v(
        "onCreateView",
        "inflater=%s, container=%s, savedInstanceState=%s",
        inflater,
        container,
        savedInstanceState);
    View view = inflater.inflate(R.layout.fragment_recipe, container, false);
    if (getArguments() == null) {
      logger.e("onCreateView", "no Arguments");
      return view;
    }
    mRecipeId = getArguments().getLong(ARG_RECIPE_ID);
    mRecipe = mDbOpenHelper.getDaoSession().getRecipeDao().load(mRecipeId);
    logger.v("onCreateView", "mRecipe=%s", mRecipe);

    AsyncImageView imageView = (AsyncImageView) view.findViewById(R.id.fragment_test_image_id);
    imageView.setUrl("http://dummyimage.com/380x380");
    Loader loader = getActivity().getLoaderManager().initLoader(0, null, imageView);
    loader.forceLoad();

    return view;
  }
 /**
  * Use this factory method to create a new instance of this fragment using the provided
  * parameters.
  *
  * @param recipeId
  * @return
  */
 public static RecipeFragment newInstance(Long recipeId) {
   logger.v("newInstance", "recipeId=%s", recipeId);
   RecipeFragment fragment = new RecipeFragment();
   Bundle args = new Bundle();
   args.putLong(ARG_RECIPE_ID, recipeId);
   fragment.setArguments(args);
   return fragment;
 }
 @Override
 public void onAttach(Activity activity) {
   logger.v("onAttach", "mRecipeId=%s, activity=%s", mRecipeId, activity);
   super.onAttach(activity);
   try {
     mListener = (OnFragmentInteractionListener) activity;
   } catch (ClassCastException e) {
     throw new ClassCastException(
         activity.toString() + " must implement OnFragmentInteractionListener");
   }
 }
 @Override
 public void onDetach() {
   logger.v("onDetach", "mRecipeId=%s", mRecipeId);
   super.onDetach();
   mListener = null;
 }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   logger.v("onCreate", "savedInstanceState=%s", savedInstanceState);
   super.onCreate(savedInstanceState);
   mDbOpenHelper = new DbOpenHelper(getContext(), null);
 }
 public RecipeFragment() {
   logger.v("RecipeFragment", null);
 }
/**
 * A simple {@link Fragment} subclass. Activities that contain this fragment must implement the
 * {@link RecipeFragment.OnFragmentInteractionListener} interface to handle interaction events. Use
 * the {@link RecipeFragment#newInstance} factory method to create an instance of this fragment.
 */
public class RecipeFragment extends Fragment {

  private static final Logger logger = Logger.of(RecipeFragment.class);
  public static final String ARG_RECIPE_ID = "mRecipeId";

  private Long mRecipeId;
  private Recipe mRecipe;
  private DbOpenHelper mDbOpenHelper;
  private OnFragmentInteractionListener mListener;

  /**
   * Use this factory method to create a new instance of this fragment using the provided
   * parameters.
   *
   * @param recipeId
   * @return
   */
  public static RecipeFragment newInstance(Long recipeId) {
    logger.v("newInstance", "recipeId=%s", recipeId);
    RecipeFragment fragment = new RecipeFragment();
    Bundle args = new Bundle();
    args.putLong(ARG_RECIPE_ID, recipeId);
    fragment.setArguments(args);
    return fragment;
  }

  public RecipeFragment() {
    logger.v("RecipeFragment", null);
  }

  @Override
  public void onCreate(Bundle savedInstanceState) {
    logger.v("onCreate", "savedInstanceState=%s", savedInstanceState);
    super.onCreate(savedInstanceState);
    mDbOpenHelper = new DbOpenHelper(getContext(), null);
  }

  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    logger.v(
        "onCreateView",
        "inflater=%s, container=%s, savedInstanceState=%s",
        inflater,
        container,
        savedInstanceState);
    View view = inflater.inflate(R.layout.fragment_recipe, container, false);
    if (getArguments() == null) {
      logger.e("onCreateView", "no Arguments");
      return view;
    }
    mRecipeId = getArguments().getLong(ARG_RECIPE_ID);
    mRecipe = mDbOpenHelper.getDaoSession().getRecipeDao().load(mRecipeId);
    logger.v("onCreateView", "mRecipe=%s", mRecipe);

    AsyncImageView imageView = (AsyncImageView) view.findViewById(R.id.fragment_test_image_id);
    imageView.setUrl("http://dummyimage.com/380x380");
    Loader loader = getActivity().getLoaderManager().initLoader(0, null, imageView);
    loader.forceLoad();

    return view;
  }

  @Override
  public void onAttach(Activity activity) {
    logger.v("onAttach", "mRecipeId=%s, activity=%s", mRecipeId, activity);
    super.onAttach(activity);
    try {
      mListener = (OnFragmentInteractionListener) activity;
    } catch (ClassCastException e) {
      throw new ClassCastException(
          activity.toString() + " must implement OnFragmentInteractionListener");
    }
  }

  @Override
  public void onDetach() {
    logger.v("onDetach", "mRecipeId=%s", mRecipeId);
    super.onDetach();
    mListener = null;
  }

  /**
   * This interface must be implemented by activities that contain this fragment to allow an
   * interaction in this fragment to be communicated to the activity and potentially other fragments
   * contained in that activity.
   *
   * <p>See the Android Training lesson <a href=
   * "http://developer.android.com/training/basics/fragments/communicating.html" >Communicating with
   * Other Fragments</a> for more information.
   */
  public interface OnFragmentInteractionListener {
    public void onFragmentInteraction();
  }
}