Java 无法解决,或者它';这不是一个领域

Java 无法解决,或者它';这不是一个领域,java,android,Java,Android,我在“***无法解决或不是字段”行中遇到此错误。 mainactivity.java Integer num1=Integer.parseInt(number1text.getText().toString()); num2=Integer.parseInt(number2text.getText().toString()), num3=Integer.parseInt(number3text.getText().toString());

我在“***无法解决或不是字段”行中遇到此错误。 mainactivity.java

        Integer num1=Integer.parseInt(number1text.getText().toString()); 
        num2=Integer.parseInt(number2text.getText().toString()), 
        num3=Integer.parseInt(number3text.getText().toString());
        Integer del= num2*num2+4*num1*num3 ;
        Integer x1=-num2-del/2*num1 ;
        Integer x2=-num2+del/2*num1 ;
        TextView delta=(TextView)findViewById(R.id.deltatxt);
        TextView x1=(TextView)findViewById(R.id.x1txt);
        TextView x2=(TextView)findViewById(R.id.x2txt);
        delta.setText("Delta:"+del.toString());
        x1.setText("X1:"+x1.toString());
        x2.setText("X2:"+x2.toString());
fragment.xml:

    <TextView
        android:id="@+id/num1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Numarul2(b)" />

    <EditText
        android:id="@+id/num1text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:inputType="numberSigned" />

    <TextView
        android:id="@+id/num2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Numarul3(c)" />

    <EditText
        android:id="@+id/num2text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:inputType="numberSigned" />

    <Button
        android:id="@+id/button1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/calc" 
        android:OnClick="calculate"/>

因此,我添加了ID,但它们在maina Activity中无法识别。提前谢谢

这写得不好:

android:OnClick="calculate" />
应该是:

android:onClick="calculate" />

当你拼写错误时,R不会编译。

你的意思是
R
无法解决?如果是这样,请尝试清理并构建项目。您是否可以显示导入并检查资源中是否存在任何错误files@donfuxx:例如,当我尝试添加R.id.num1txt时,找不到它。@Raghunandan这就是我写的全部内容。没有错误。我的进口是“num1,num2,num3,num1txt,num2txt,num3txt,delta,x1,x2。@user3450385我正在学习导入语句。我猜你已经
导入了android.R和R.java。不客气。但我不是,先生……;)如果你觉得有帮助的话,别忘了接受我的回答。