Arslan Ahmed Awan Arslan Ahmed Awan - 6 months ago 55
Java Question

Java _ Cannot Find Symbol Class

I am Write a Program that gets two values from two text fields and calculates their result.

The problem, I am facing is that Java Editor Shows me the following errors.

cannot find symbol class EditText
cannot find symbol class Button
cannot find symbol class string
cannot find symbol class variable integer
cannot find symbol class integer

My Code is .........

public class MainActivity extends AppCompatActivity
EditText firstNumber;
EditText secondNumber;
Button btnAdd;
TextView total;

protected void onCreate(Bundle savedInstanceState)

firstNumber = (EditText)findViewById(;
secondNumber = (EditText)findViewById(;
btnAdd = (Button)findViewById(;
total = (TextView)findViewById(;

public void btnAdd_Click(View view)
string getfirstNumber = firstNumber.getText().toString();
string getsecondNumber = secondNumber.getText().toString();
integer totalResult = integer.parseInt(getfirstNumber) + integer.parseInt(getsecondNumber);
total.setText("Total = " + integer.toString(totalResult));



use following imports

import android.widget.Button;
import android.widget.EditText;