So I'm trying to make the button redirect to another class, my application is stopping when I try to click the button Play and this is what the logcat says
Caused by: java.lang.NullPointerException at com.example.kenneth.rusa.Play.onCreate(Play.java:26)
Play, java:26 is
Button play = (Button) findViewById(R.id.playb);
play.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(Play.this, GamePanelEasy.class));
}
Here's my manifest:
<activity android:screenOrientation="landscape" android:name=".Play">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
I don't have any errors but it's still crashing, I don't know why the logcat says I have error in line 26 which is play.setOnClickListener(new View.OnClickListener(){ }
Thanks for the help guys I found out what's my problem playb was been duplicated from another class I changed it to easyb so it works fine now thanks!