Error in TextView in Android Studio.

Asked 2 years ago, Updated 2 years ago, 23 views

https://www.youtube.com/watch?v=dk_AyDJL61g&index=2&t=279s&list=PLRx0vPvlEmdB6sCgj_jubp8KPb1ni0VOC

I watched the lecture above and made it. By the way, the error cannot find variable TextView and the error illigal start of type appear on the TextView side.


   public void addClick(View v){
        EditText number1 = (EditText) findViewById(R.id.number1);
        EditText number2 = (EditText) findViewById(R.id.number2);
        TextView result = (TextView) = findViewById(R.id.result);
        int n1 = Integer.parseInt(number1.getText().toString());
        int n2 = Integer.parseInt(number2.getText().toString());
        result.setText(Integer.toString(n1 + n2));}

TextView is imported...

android

2022-09-22 11:06

1 Answers

TextView result = (TextView) =
= You have to take it out. There are two typos.


2022-09-22 11:06

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.