@Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.apps_fragment, container, false);

    mListView = (ListView) view.findViewById(android.R.id.list);
    mProgressBar = view.findViewById(android.R.id.progress);
    mEmptyView = view.findViewById(android.R.id.empty);
    mErrorReporter = new ErrorReporter(getActivity(), view, AppContract.Apps.CONTENT_URI);

    mListView.setOnItemClickListener(this);

    Bitmap placeHolder = BitmapFactory.decodeResource(getResources(), R.drawable.placeholder);
    mRemoteImageLoader =
        RemoteImageLoader.createUsingDp(getActivity(), placeHolder, IMAGE_SIZE_DP, IMAGE_SIZE_DP);

    mAdapter = new AppsAdapter(getActivity(), mRemoteImageLoader, this);
    mListView.setAdapter(mAdapter);

    mDownloadHelper =
        new DownloadHelper(
            getActivity(), DownloadService.ACTION_SYNC, this, AppContract.Apps.CONTENT_URI);
    LoaderManager lm = getLoaderManager();
    lm.initLoader(LOADER_APPS, null, this);

    setHasOptionsMenu(true);

    return view;
  }
 @Override
 public void onResume() {
   super.onResume();
   mDownloadHelper.onActivityResume();
   mDownloadHelper.startDownloading(null, false);
   mRemoteImageLoader.onActivityResume();
 }
 @Override
 public void onPause() {
   super.onPause();
   mDownloadHelper.onActivityPause();
   mRemoteImageLoader.onActivityPause();
 }
 @Override
 public void onLowMemory() {
   super.onLowMemory();
   mRemoteImageLoader.onActivityLowMemory();
 }