清单正确时,找不到用于处理Intent的活动 [英] No Activity found to handle Intent when the manifest is correct
本文介绍了清单正确时,找不到用于处理Intent的活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经处理了一个小时,我无法弄清楚这个问题.当ACTION_UP
TouchEvent中的boolean
值为true
时,我试图启动一个新的activity
.
I have been going over this for an hour and I cannot figure out the issue. I am trying to launch a new activity
when a boolean
value is true
inside the ACTION_UP
TouchEvent.
public boolean onTouchEvent(MotionEvent event) {
int eventaction = event.getAction();
int X = (int)event.getX();
int Y = (int)event.getY();
fingerX = X;
fingerY = Y;
switch (eventaction ) {
case MotionEvent.ACTION_DOWN:
if (okayButton){
if (fingerX > 323 && fingerX < 423) {
largeOkayButton = true;
}
}
break;
case MotionEvent.ACTION_MOVE:
break;
case MotionEvent.ACTION_UP:
tutorial = true;
if (startActivity){
//create an Intent variable titled openStartingPoint and pass its activity action from the Android Manifest.xml
Intent MainActivity = new Intent("com.example.shoottoiletpaper.MAINACTIVITY");
//start a new activity by passing the newly created Intent
startActivity(MainActivity);
}
break;
}
return true;
}
一切正常,直到启动activity
为止,当它强制关闭时,我会在logcat中找到它:
Everything works until it gets to launching the activity
, when it force closes and I get this in the logcat:
android.content.ActivityNotFoundException: No Activity found to handle Intent
这是manifest
的相关部分:
<activity
android:name="com.example.shoottoiletpaper.MainActivity"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboard"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAINACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
有什么想法吗?
推荐答案
更改此内容
Intent MainActivity = new Intent("com.example.shoottoiletpaper.MAINACTIVITY");
到
Intent MainActivity = new Intent("android.intent.action.MAINACTIVITY");
这篇关于清单正确时,找不到用于处理Intent的活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文