@Override
  protected void onPostExecute(Exception ex) {
    for (OnAsyncTaskCompletedListener listenerInstance : listener) {
      if (listenerInstance != null) listenerInstance.onAsyncTaskCompleted(task_id, ex);
    }

    detach();
  }
  @Override
  protected void onPostExecute(Object ex) {
    for (OnAsyncTaskCompletedListener listenerInstance : listener) {
      if (listenerInstance != null) listenerInstance.onAsyncTaskCompleted(task_id, ex);
    }

    SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(context);
    if (mPrefs.getBoolean(SettingsActivity.CB_CACHE_IMAGES_OFFLINE_STRING, false)) {
      if (!NetworkConnection.isWLANConnected(context)
          && NetworkConnection.isNetworkAvailable(context)) ShowDownloadImageWithoutWifiQuestion();
      else if (NetworkConnection.isNetworkAvailable(context))
        StartDownloadingImages(context, highestItemIdBeforeSync, false);
    } else {
      StartDownloadingImages(context, highestItemIdBeforeSync, true);
    }

    detach();
  }
  @Override
  protected void onPostExecute(Object ex) {
    for (OnAsyncTaskCompletedListener listenerInstance : listener) {
      if (listenerInstance != null) listenerInstance.onAsyncTaskCompleted(task_id, ex);
    }

    if (ex == null && NetworkConnection.isNetworkAvailable(context)) {
      SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(context);

      int syncStrategy =
          Integer.parseInt(mPrefs.getString(SettingsActivity.LV_CACHE_IMAGES_OFFLINE_STRING, "0"));

      boolean downloadImages = false;

      switch (syncStrategy) {
        case 0:
          break;
        case 1: // Download via WiFi only
          if (NetworkConnection.isWLANConnected(context)) downloadImages = true;
          break;
        case 2: // Download via WiFi and Mobile
          downloadImages = true;
          break;
        case 3: // Download via WiFi and ask for mobile
          if (!NetworkConnection.isWLANConnected(context)) ShowDownloadImageWithoutWifiQuestion();
          else downloadImages = true;
          break;
      }

      if (downloadImages) // If images should be cached
      StartDownloadingImages(context, highestItemIdBeforeSync, false);
      else // Download favIcons
      StartDownloadingImages(context, highestItemIdBeforeSync, true);
    }

    detach();
  }