Java 安卓数独游戏,按键崩溃游戏
我正在创建一个数独游戏,但当我按下按钮时,游戏崩溃了。这是我的密码: FPSudoku.java:Java 安卓数独游戏,按键崩溃游戏,java,android,sudoku,Java,Android,Sudoku,我正在创建一个数独游戏,但当我按下按钮时,游戏崩溃了。这是我的密码: 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 F
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
更新的日志猫
02-25 00:36:08.623:调试/AndroidRuntime(818):>>>>>>>>>>>>>>>>>AndroidRuntime启动02-25 00:36:11.254:DEBUG/AndroidRuntime(831):>>AndroidRuntime开始隐藏在您的日志中是您问题的答案:
ActivityNotFoundException: Unable to find explicit activity class {org.example.fpsudoku/org.example.fpsudoku.Howtoplay}; have you declared this activity in your AndroidManifest.xml?
隐藏在日志中的是您问题的答案:
ActivityNotFoundException: Unable to find explicit activity class {org.example.fpsudoku/org.example.fpsudoku.Howtoplay}; have you declared this activity in your AndroidManifest.xml?
我想你刚才弄坏了我的眉毛。我想你刚才弄坏了我的眉毛。你是一个英雄,因为你的回答掩盖了真正的问题,但这显然是一个不情愿的例外非常感谢,我在舱单上声明了这一点,但我仍然有相同的error@rich-在manifest.xml中,您已在父活动(.FPSudoku)中添加了.Howtoplay。您需要关闭第一个的标记。希望这能奏效,祝你的游戏好运!你是一个英雄,因为你的回答掩盖了真正的问题,这显然是一个不情愿的例外非常感谢,我在舱单上声明了这一点,但我仍然有相同的error@rich-在manifest.xml中,您已在父活动(.FPSudoku)中添加了.Howtoplay。您需要关闭第一个的标记。希望这能奏效,祝你的游戏好运!