Android开发学习笔记-显示对话框
private void ShowUpdateDialog() { Log.i("version", "shengji"); AlertDialog.Builder dialog = new Builder(this); dialog.setTitle("提醒升级"); dialog.setMessage("是否进行升级?"); dialog.setPositiveButton("立刻升级", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub } }); dialog.setNegativeButton("暂不升级", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub dialog.dismiss(); ShowMainActivity(); } }); dialog.show(); }