Unable to solve errors in android?

一世执手 提交于 2019-11-29 16:08:30

i am going through your code, remove findViewById from your code

setContentView(findViewById(R.layout.endgame));
Check your manifest file you register activity
android.content.ActivityNotFoundException: No Activity found to handle Intent {     act=EndgameActivity }

The problem is not that your EndgameActivity cannot be found. The exception:

ActivityNotFoundException: No Activity found to handle Intent { act=EndgameActivity }

tells you that EndgameActivity is somehow being treated as an action. This is odd because you are neither using the constructor Intent(String):

Intent i = new Intent("EndgameActivity");

Nor using Intent#setAction(String).

Try using the fully-qualified class name:

Intent i = new Intent(com.abc.cyk.QuestionActivity.this,
                                            com.abc.cyk.EndgameActivity.class);

Another thing you can try:

Intent i = new Intent();
i.setClass(QuestionActivity.this, com.abc.cyk.EndgameActivity.class);
startActivity(i);
finish();

Although its unrelated to your current issue, I noticed that in EndgameActivity#onCreate(Bundle), you're using:

setContentView(findViewById(R.layout.endgame));

This should be changed to:

setContentView(R.layout.endgame);

Addyour EndGame Activity in the manifest file. Logcat clearly says

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=EndgameActivity }

Just add the EndgameActivity in the manifest file inside a new activity tag.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!