Android Open Source - poppas_haven Error_ Message






From Project

Back to project page poppas_haven.

License

The source code is released under:

MIT License

If you think the Android project poppas_haven 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.hssdevelopment.poppas_haven;
//from   ww  w.  j  av  a 2  s. c o m
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;

/*Purpose: Error Message can be invoked in an activity to display 
 * an error message in a dialog box to the user by passing to this class the
 * message string and the current activity context, and calling the showErrorMessage function.
 */
public class Error_Message 
{
  private Activity UI_Context;
  private AlertDialog.Builder messageBuilder;
  private String errorMessage;
  
  //Error message to show at the top of the dialog box
  private static final String ERROR_MESSAGE_TITLE = "An Error Has Occured";
  
  Error_Message(Activity UI_Context, String errorMessage)
  {
    this.UI_Context = UI_Context;
    this.errorMessage = errorMessage;
  }
  
  /*showErrorMessage()
   * Builds an Alert Dialog Box that shows an error message to the user with 
   * an ok button. Immediately after calling this function, the calling activity
   * should call finish()
   */
  
  public void showErrorMessage()
  {
    //Create new Dialog builder
    messageBuilder = new AlertDialog.Builder(UI_Context);
    
    //Set positive button to okay and set okay button click to close
    //current activity
    messageBuilder.setPositiveButton("Okay", new OnClickListener()
    {
      @Override
      public void onClick(DialogInterface dialog, int which) 
      {
        UI_Context.finish();
      }
    });
    
    //Set Error Message Title
    messageBuilder.setTitle(ERROR_MESSAGE_TITLE);
    
    //Set Error Message
    messageBuilder.setMessage(errorMessage);
    
    messageBuilder.show();
  }
}




Java Source Code List

.Drink_Menu.java
.OrderOptions.java
com.hssdevelopment.poppas_haven.CheckBoxChecker.java
com.hssdevelopment.poppas_haven.CheckBoxReference.java
com.hssdevelopment.poppas_haven.Error_Message.java
com.hssdevelopment.poppas_haven.ExpandableListAdapter.java
com.hssdevelopment.poppas_haven.HomeScreen.java
com.hssdevelopment.poppas_haven.MenuAdapter.java
com.hssdevelopment.poppas_haven.MilkOptions.java
com.hssdevelopment.poppas_haven.ReviewOrder.java
com.hssdevelopment.poppas_haven.UI_Category_Menu.java
com.hssdevelopment.poppas_haven.UI_Drink_Menu.java
com.hssdevelopment.poppas_haven.UI_Hot_Iced.java
com.hssdevelopment.poppas_haven.UI_Milk_Options.java
com.hssdevelopment.poppas_haven.UI_Sauce_Syrup_Menu.java