use of com.github.ignition.core.exceptions.ResourceMessageException in project ignition by mttkay.
the class IgnitedDialogs method newErrorDialog.
public static AlertDialog.Builder newErrorDialog(final Activity activity, String title, Exception error) {
String screenMessage = "";
if (error instanceof ResourceMessageException) {
screenMessage = activity.getString(((ResourceMessageException) error).getClientMessageResourceId());
} else {
screenMessage = error.getLocalizedMessage();
}
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(title);
builder.setMessage(screenMessage);
builder.setIcon(android.R.drawable.ic_dialog_alert);
builder.setCancelable(false);
builder.setPositiveButton(activity.getString(android.R.string.ok), new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
return builder;
}
Aggregations