我已经研究了一个小时,但我无法弄清楚这个问题。activity
当boolean
值true
在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 中得到了这个:
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>
有任何想法吗?