Advertisement
samadhanmedge

AlertDialog

Jan 16th, 2013
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. //AlertDialoge class
  2.  
  3.  
  4. public class AlertDialogManager
  5. {
  6.     public void showAlertDialog(Context context,String title, String message, Boolean status)
  7.     {
  8.         AlertDialog alertDialog = new AlertDialog.Builder(context).create();
  9.        
  10.         alertDialog.setTitle(title);
  11.         alertDialog.setMessage(message);
  12.         new AlertDialog.Builder(
  13.                   new ContextThemeWrapper(context, android.R.style.Theme_Dialog));
  14.        
  15.         if(status!=null)
  16.         {
  17.             alertDialog.setIcon((status)? R.drawable.success :R.drawable.fail);
  18.         }
  19.        
  20.         alertDialog.setButton("OK", new DialogInterface.OnClickListener()
  21.         {          
  22.             @Override
  23.             public void onClick(DialogInterface arg0, int arg1)
  24.             {
  25.             }
  26.         });
  27.         alertDialog.show();
  28.     }
  29.  
  30. }
  31.  
  32.  
  33.  
  34. // call it in any class as you wish like
  35. alert.showAlertDialog(CurrencyConversion.this, "Internet Connection Error", "Please connect to working Internet connection", false);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement