@Override
  public void onDestroy() {
    super.onDestroy();

    // See http://stackoverflow.com/questions/18264408/incomplete-asynctask-crashes-my-app
    if (nearbyAsyncTask != null && nearbyAsyncTask.getStatus() != AsyncTask.Status.FINISHED) {
      nearbyAsyncTask.cancel(true);
    }
  }
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {

    // Check that this is the first time view is created, to avoid double list when screen
    // orientation changed
    if (savedInstanceState == null) {
      mLatestLocation = ((NearbyActivity) getActivity()).getmLatestLocation();
      listview = (ListView) getView().findViewById(R.id.listview);
      nearbyAsyncTask = new NearbyAsyncTask(this);
      nearbyAsyncTask.execute();
      progressBar.setVisibility(View.VISIBLE);
      Log.d(TAG, "Saved instance state is null, populating ListView");
    } else {
      progressBar.setVisibility(View.GONE);
    }

    // If we are returning here from a screen orientation and the AsyncTask is still working,
    // re-create and display the progress dialog.
    if (isTaskRunning) {
      progressBar.setVisibility(View.VISIBLE);
    }
  }