package com.apiprintdemo;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
 
//提示对话框
public class MyClass   extends Activity {


	void myAlertDialog(Context context,String title,String message)
	{
		AlertDialog dialog=new AlertDialog.Builder(context)
		.setTitle(title)
		.setMessage(message)
		.setNegativeButton("确定", new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int which) {
				// TODO Auto-generated method stub
				dialog.cancel();
			}
		})
		.create();
		dialog.setCancelable(false);
		dialog.show();
	}
	
	void ExitAlertDialog(Context context,String title,String message)
	{
		AlertDialog dialog=new AlertDialog.Builder(context)
		.setTitle(title)
		.setMessage(message)
		.setPositiveButton("确定", new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface builder, int which) {
				// TODO Auto-generated method stub
				builder.cancel();
				System.exit(0);  
			
			}
		}) .setNegativeButton("取消", new DialogInterface.OnClickListener() { 
	           public void onClick(DialogInterface builder, int which) { 
	        	   builder.cancel(); 
	           } 
	       })
		.create();
		dialog.setCancelable(false);
		dialog.show();
	}	

}