aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/util/ErrorDialog.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/util/ErrorDialog.java b/subsonic-android/src/github/daneren2005/dsub/util/ErrorDialog.java
index 2928e93f..ab9b4fa3 100644
--- a/subsonic-android/src/github/daneren2005/dsub/util/ErrorDialog.java
+++ b/subsonic-android/src/github/daneren2005/dsub/util/ErrorDialog.java
@@ -21,6 +21,8 @@ package github.daneren2005.dsub.util;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
+import android.content.Intent;
+import github.daneren2005.dsub.activity.MainActivity;
import github.daneren2005.dsub.R;
/**
@@ -43,7 +45,7 @@ public class ErrorDialog {
@Override
public void onCancel(DialogInterface dialogInterface) {
if (finishActivityOnClose) {
- activity.finish();
+ restart(activity);
}
}
});
@@ -51,11 +53,17 @@ public class ErrorDialog {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if (finishActivityOnClose) {
- activity.finish();
+ restart(activity);
}
}
});
builder.create().show();
}
+
+ private void restart(Activity context) {
+ Intent intent = new Intent(context, MainActivity.class);
+ intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ Util.startActivityWithoutTransition(context, intent);
+ }
}