public class sci_message { public sci_message() { // TODO Auto-generated constructor stub } //1.弹出提示消息 public static void message(Context Context, String str) { new AlertDialog.Builder(context) .setMessage(str) .setPositiveButton("OK", null) .show(); } //2.退出询问消息 public static void quitMessage(Context Context, String ask, String bt1, String bt2) { String str[]={"Are you sure to quit?", "Yes", "No"}; //默认消息 if(ask != null) str[0] = ask; if(bt1 != null) str[1] = bt1; if(bt2 != null) str[2] = bt2; new AlertDialog.Builder(context) //.setTitle("") .setMessage(str[0]) .setPositiveButton(str[1], new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialoginterface, int i) { MID.mid.finish() ; //退出游戏动作 } }) .setNegativeButton(str[2], null) .show(); } //3.提示消息 public static void toast(Context Context, String str) { Toast t3=Toast.makeText(context, str, Toast.LENGTH_SHORT); t3.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.CENTER_VERTICAL, 0, 0); t3.show(); } }
安卓_弹出消息
最新推荐文章于 2024-03-18 18:17:56 发布