Android Build an Interactive Story App User Input Finding Views by IDs

FindViewById

syntax error

MainActivity.java
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {

    protected Button exterminateButton;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Declare our view variables
       exterminateButton = (Button1) findViewById(R.id.button1);

    }

}

2 Answers

Maciej Czuchnowski
Maciej Czuchnowski
36,427 Points

The casting should be done to (Button), not (Button1).

THANX FOR THE HELP