Android 来自结果EditText的if语句

Android 来自结果EditText的if语句,android,if-statement,Android,If Statement,我想使用if从结果类更改图像,但我不知道如何从result.getText显示图像。结果从1到100 解决 CalculatorValue cv = new CalculatorValue (); String calculationVal= cv.calculationVal(num1+ "compare" + num2); Result.setText(calculationVal+ " %"); if (result

我想使用if从结果类更改图像,但我不知道如何从result.getText显示图像。结果从1到100

解决

CalculatorValue cv = new CalculatorValue ();
                    String calculationVal= cv.calculationVal(num1+ "compare" + num2);

                Result.setText(calculationVal+ " %");
if (result < 10){
        img.setBackgroundResource(R.drawable.ic_110);
    } 
CalculatorValue cv=new CalculatorValue();
字符串calculationVal=cv.calculationVal(num1+“比较”+num2);
Result.setText(calculationVal+“%”);
如果(结果<10){
img.setBackgroundResource(R.drawable.ic_110);
} 
你能帮我举个例子吗

多谢各位

代码不起作用

if (result < 10){
     // your code
} 
if (result >10 && result <15){
     // your code
}
else
if(结果<10){
//你的代码
} 

如果(result>10&&result在您的案例中有一个很大的语法错误。这是一个孤立的表达式,它会让编译器跪在那里试图找出:

if (result >10 <15) // This is incomprehensible , doesn't work.

if(result>10)如果(result<10){//your code}if(result>10&&result),您的代码不工作
if (result >10 <15) // This is incomprehensible , doesn't work.
if (result < 10){
     // your code
} 
if (result >10 && result <15){
     // your code
}
else
  ....