I wrote a very simple activity in which when a button is pressed it changes to another one. But it seems to be unable to resolve symbol on line 24, the second setOnClickListener and I am honestly pulling my hairs here. Its not the same, because the code should work.
package com.example.example.ramdomjokes;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
TextView JokeText;
Jokes jokeHolder = new Jokes();
Button btncat;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
JokeText = (TextView) findViewById(R.id.JokeText);
btncat = (Button)findViewById(R.id.button2);
btncat.setOnClickListener(new View.setOnClickListener(){
public void onClick(View view){
Intent i = new Intent(MainActivity.this, cats.class);
startActivity(i);
}
} );
}
public void genJoke(View view)
{
JokeText.setText(jokeHolder.nextJoke());
}
}