/** If the update was successful restart the MainActivity */
      @Override
      protected void onPostExecute(String result) {
        super.onPostExecute(result);

        progr_dlg.dismiss();

        // After all the update is (succesfully) done we have to restart
        // the main activity

        if (DONE.equals(result)) {
          // either we were started tru intent (return to main)
          if (context instanceof PreferencesActivity) {
            Activity a = (Activity) context;
            a.setResult(PreferencesActivity.RESULT_DATA_UPDATED);
            // this will call on activity result
            a.finish();
          }

          // or directly by passing context: restart directly
          if (context instanceof MainActivity) {
            MainActivity mainActivity = (MainActivity) context;
            mainActivity.restartActivity(0);
          }
        }
      }
      @Override
      protected void onProgressUpdate(Integer... progress) {
        Log.i("onProgressUpdate", "pr:" + progress[0]);

        int current_progress = progress[0];
        if (progr_dlg.isShowing()) {
          progr_dlg.setProgress(current_progress);

          /* if downloading is done, we're updating DB */
          if (current_progress == ZipDownloaderTask.PROGRESS_DONE) {
            progr_dlg.setMessage(
                context.getResources().getString(R.string.files_downloaded_updating_db));
            progr_dlg.setProgress(100);
            progr_dlg.setIndeterminate(true);
          }
        }
        // TODO Auto-generated method stub
        super.onProgressUpdate(progress);
      }