/* @setTitle 设置对话框标题
         * @setMessage 设置对话框消息提示
         */
        final AlertDialog.Builder normalDialog = new AlertDialog.Builder(SetActivity.this);
        normalDialog.setTitle("退出");
        normalDialog.setMessage("确认要退出登录吗?");
        normalDialog.setPositiveButton("确定",new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        Intent intent = new Intent(SetActivity.this, LoginUserActivity.class);
                        intent.setFlags(intent.FLAG_ACTIVITY_CLEAR_TASK|intent.FLAG_ACTIVITY_NEW_TASK);
                        startActivity(intent);
                    }
                });
        normalDialog.setNegativeButton("取消",new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {

                    }
                });

        // 显示
        normalDialog.show();

 

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐