Я создаю игру судоку, но когда я нажимаю кнопку, игра вылетает. Вот мой код:
FPSudoku.java:
package org.example.fpsudoku;
import android.app.Activity; import
android.os.Bundle; import
android.content.Intent; import
android.view.View; import
android.view.View.OnClickListener;
public class FPSudoku extends Activity
implements OnClickListener{
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
View newButton = findViewById(R.id.new_game_button);
newButton.setOnClickListener(this);
View aboutButton = findViewById(R.id.how_to_play_button);
aboutButton.setOnClickListener(this);
View exitButton = findViewById(R.id.exit_game_button);
exitButton.setOnClickListener(this);
}
public void onClick(View v) {
switch (v.getId()) {
case R.id.how_to_play_button:
Intent i = new Intent(this, Howtoplay.class);
startActivity(i);
break;
}
}
}
Howtoplay.java
package org.example.fpsudoku;
import android.app.Activity; import
android.os.Bundle;
public class Howtoplay extends
Activity { @Override protected void
onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.howtoplay);
}
}
ОБНОВЛЕНО
android manifest.xml
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".FPSudoku"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<activity android:name=".Howtoplay"
android:label="@string/how_to_play_title" >
</activity>
</activity>
</application>
updated logcat
В вашем LogCat скрыт ответ на ваш вопрос: