Android中对话框(dialog)的使用


与C#中的MessageBox.Show()方法略有不同,Android使用AlertDialog来搞!

    /*
     * 显示对话框
     */
    private void showMessage(String string)
    {
        new AlertDialog.Builder(this)
        .setTitle("提示")
        .setMessage(string)
        .setPositiveButton( "确定" ,
        new DialogInterface.OnClickListener() {
        public void onClick(
        DialogInterface dialoginterface, int i){
        }       
        }).show();   
    }

详细信息可以查看android文档,android.app.AlertDiaglog和android.app.AlertDialog.Builder这两个类。

相关内容