android - 使用alert dialog 的具体办法

访问量: 169

参考:  https://developer.android.com/guide/topics/ui/dialogs.html

就是这样:

    public void confirmUnBind(View view){
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage(R.string.confirm_to_unbind_message)
            .setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    unBind();
                }
            })
            .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener(){
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // do nothing. just click to hide
                }
            })
        ;

        builder.show();
    }

订阅/RSS Feed

Subscribe

分类/category