【问题标题】:how to fix this error "opperator && can not be applied to boolean"? [closed]如何解决此错误“运算符 && 不能应用于布尔值”? [关闭]
【发布时间】:2018-08-04 08:16:22
【问题描述】:

如何修复此错误,我尝试执行 (requestCode)&&(requestCode=Result) 但它不起作用?? 代码:

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode==12 && requestCode=RESULT_OK && data!=null){

            // start picker to get image for cropping and then use the image in cropping activity
            CropImage.activity()
                    .setGuidelines(CropImageView.Guidelines.ON)
                    .setAspectRatio(1,1)
                    .start(this);

        }

【问题讨论】:

  • equestCode=RESULT_OK 应该是equestCode==RESULT_OK
  • 您是否尝试过将 requestCode=RESULT_OK 更改为 requestCode==RESULT_OK ??
  • ...你想要resultCode 代替;即resultCode == RESULT_OK.
  • 成功了,我没注意到...非常感谢@

标签: java android int boolean


【解决方案1】:

改变

(requestCode==12 && requestCode=RESULT_OK && data!=null)

(requestCode==12 && requestCode==RESULT_OK && data!=null)

要测试价值,您必须使用 == 而不是 = 我想你只是打错了。

【讨论】:

  • 成功了.....谢谢大家
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-01-28
  • 2020-11-01
  • 2019-02-18
  • 1970-01-01
  • 2015-04-13
相关资源
最近更新 更多