继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

安卓Android

ikkyu
关注TA
已关注
手记 8
粉丝 46
获赞 93

https://img2.mukewang.com/5cb550180001595504960838.jpg

https://img.mukewang.com/5cb550180001266404960838.jpg

https://img4.mukewang.com/5cb550190001fb4104960838.jpg

https://img1.mukewang.com/5cb550190001b6eb04960838.jpg

https://img1.mukewang.com/5cb550190001d65910380612.jpg

https://img1.mukewang.com/5cb5501900018bc519182082.jpg

https://img.mukewang.com/5cb5501a0001d6e019181938.jpg

b1.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {

        if (e1.getText().toString().isEmpty()||e2.getText().toString().isEmpty()) {
            Toast.makeText(MainActivity.this, "空", Toast.LENGTH_SHORT).show();
        }
        else if (r1.isChecked()) {
            Double wb1 = Double.parseDouble(e1.getText().toString());
            Double wb2 = Double.parseDouble(e2.getText().toString());
            Double result = wb1 +wb2;
            t1.setText(result.toString());
        } else if (r2.isChecked()) {
            Double wb1 = Double.parseDouble(e1.getText().toString());
            Double wb2 = Double.parseDouble(e2.getText().toString());
            Double result = wb1 - wb2;
            t1.setText(result.toString());
        } else {
            AlertDialog.Builder dlg = new AlertDialog.Builder(MainActivity.this);
            dlg.setTitle("错误error");
            dlg.setMessage("请检查控件或文本框有没有被输入和选中");
            dlg.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {

                }
            });
            dlg.show();
        }


打开App,阅读手记
0人推荐
发表评论
随时随地看视频慕课网APP