Next button not working in Android Studio

I have added a next button to my java class page and it doesn’t recognise ‘setContentView’ or ‘findViewbyId’ could anyone tell me why? I have declared the nextButton at the start of the class.

 public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.dashboard);
    nextButton = (Button) findViewById(R.id.Confirm_button);
}