我已經過了一個小時,我找不出這個問題。我試圖在ACTION_UP
TouchEvent內boolean
的值爲true
時嘗試啓動新的activity
。當清單正確時,沒有找到處理意圖的活動
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>
有什麼建議嗎?
非常感謝你,這固定它。有時,它是簡單的事情是最困難的! – user1956807 2013-03-20 23:10:20