2
This file is part of Subsonic.
4
Subsonic is free software: you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation, either version 3 of the License, or
7
(at your option) any later version.
9
Subsonic is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with Subsonic. If not, see <http://www.gnu.org/licenses/>.
17
Copyright 2009 (C) Sindre Mehus
19
package net.sourceforge.subsonic.androidapp.util;
21
import android.app.Activity;
22
import android.app.AlertDialog;
23
import android.content.DialogInterface;
26
* @author Sindre Mehus
28
public class ErrorDialog {
30
public ErrorDialog(final Activity activity, String errorMessage, final boolean finishActivityOnCancel) {
32
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
33
builder.setIcon(android.R.drawable.ic_dialog_alert);
34
builder.setTitle("Error");
35
builder.setMessage(errorMessage);
36
builder.setCancelable(true);
37
builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
39
public void onCancel(DialogInterface dialogInterface) {
40
if (finishActivityOnCancel) {
45
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
47
public void onClick(DialogInterface dialogInterface, int i) {
48
if (finishActivityOnCancel) {
54
builder.create().show();