Android Open Source - Android-SDK-Demo Alert Utils






From Project

Back to project page Android-SDK-Demo.

License

The source code is released under:

Apache License

If you think the Android project Android-SDK-Demo listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.baasbox.demo.util;
/*www . ja  v a  2s  . co m*/
import android.app.AlertDialog;
import android.content.Context;

import com.baasbox.android.BaasClientException;
import com.baasbox.android.BaasException;
import com.baasbox.android.BaasServerException;

public class AlertUtils {

  public static void showErrorAlert(Context context, BaasClientException e) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setCancelable(true);
    builder.setTitle("Client Error");
    builder.setMessage("An unexpected app error: " + e.httpStatus + " (" + e.code + ") :" + e.getMessage());
    builder.setNegativeButton("Cancel", null);
    builder.create().show();
  }
  
  public static void showErrorAlert(Context context, BaasServerException e) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setCancelable(true);
    builder.setTitle("Server Error");
    builder.setMessage("An unexpected server error: " + e.httpStatus + " (" + e.code + "):" + e.getMessage());
    builder.setNegativeButton("Cancel", null);
    builder.create().show();
  }
  
  public static void showErrorAlert(Context context, BaasException e) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setCancelable(true);
    builder.setTitle("Error");
    builder.setMessage("An unexpected error: " + e.getMessage());
    builder.setNegativeButton("Cancel", null);
    builder.create().show();
  }
}




Java Source Code List

com.baasbox.demo.AddressBookActivity.java
com.baasbox.demo.App.java
com.baasbox.demo.LoginActivity.java
com.baasbox.demo.SignupActivity.java
com.baasbox.demo.util.AlertUtils.java