Beispiel #1
0
  public static void showErrorAndFinish(final Activity activity, Exception ex) {
    try {
      Log.e(activity.getClass().getName(), Utils.getErrorMessage(ex));
      ex.printStackTrace();

      new AlertDialog.Builder(activity)
          .setMessage(Utils.getErrorMessage(ex))
          .setCancelable(false)
          .setPositiveButton(
              android.R.string.ok,
              new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface arg0, int arg1) {
                  activity.finish();
                }
              })
          .show();
    } catch (WindowManager.BadTokenException unused) {
      /* Ignore... happens if the activity was destroyed */
    }
  }
Beispiel #2
0
 public static void showError(final Activity activity, Exception ex) {
   Log.e(activity.getClass().getName(), ex.getMessage(), ex);
   new AlertDialog.Builder(activity).setMessage(Utils.getErrorMessage(ex)).show();
 }