2014-08-28 56 views
1

我知道上面的問題已被問過,但是當我在網上尋找解決方案時....我還沒有找到解決問題的方法。錯誤「無法找到明確的活動類」

導航到SingleMenuItemActivity工作正常,所以我不知道爲什麼重複這個woulr不起作用。

UPDATE:

問題是(因爲它始終是這樣的東西),是,我是導航到根本不存在的網頁...看看您確信您naivgating頁面拼寫正確。

這裏是意圖代碼:

Intent i = new Intent(getApplicationContext(), AndroidXMLParsingChamp.class); 
startActivity(i); 

這裏是清單 (代碼我指的是由'<!-- The class I am navigating to -->':標記)

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.androidhive.xmlparsing" 
    android:versionCode="1" 
    android:versionName="1.0" > 

    <uses-sdk android:minSdkVersion="8" /> 

    <application 
     android:icon="@drawable/icon" 
     android:label="@string/app_name" > 
     <activity 
      android:label="@string/app_name" 
      android:name=".AndroidXMLParsingActivity" > 
      <intent-filter > 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 

     <!-- Single List Item View --> 
     <activity 
      android:label="Single Menu Item" 
      android:name=".SingleMenuItemActivity" > 
     </activity> 

     <!-- The class I am navigating to --> 
     <activity 
      android:label="Single Menu Item" 
      android:name=".AndroidXMLParsingActivityChamp" > 
     </activity> 

     <!-- <activity android:name="com.example.rssapplication.AndroidXMLParsingActivity" android:label="@string/app_name"> 
     <intent-filter> 
      <action android:name="android.intent.action.AndroidXMLParsingActivityChamp" /> 
      <category android:name="android.intent.category.DEFAULT" /> 
     </intent-filter> 
     </activity> 

     <activity android:name="com.example.rssapplication.AndroidXMLParsingActivityChamp" android:label="@string/app_name"> 
     <intent-filter> 
      <action android:name="android.intent.action.AndroidXMLParsingActivity" /> 
      <category android:name="android.intent.category.DEFAULT" /> 
     </intent-filter> 
     </activity>--> 
    </application> 

    <uses-permission android:name="android.permission.INTERNET" /> 

</manifest> 

的logcat:

08-28 10:19:05.486: E/AndroidRuntime(3041): FATAL EXCEPTION: main 
08-28 10:19:05.486: E/AndroidRuntime(3041): Process: com.androidhive.xmlparsing, PID: 3041 
08-28 10:19:05.486: E/AndroidRuntime(3041): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.androidhive.xmlparsing/com.androidhive.xmlparsing.AndroidXMLParsingChamp}; have you declared this activity in your AndroidManifest.xml? 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1648) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1442) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.app.Activity.startActivityForResult(Activity.java:3511) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.app.Activity.startActivityForResult(Activity.java:3472) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.app.Activity.startActivity(Activity.java:3714) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.app.Activity.startActivity(Activity.java:3682) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at com.androidhive.xmlparsing.AndroidXMLParsingActivity.onTouchEvent(AndroidXMLParsingActivity.java:94) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.app.Activity.dispatchTouchEvent(Activity.java:2548) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2228) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.view.View.dispatchPointerEvent(View.java:8315) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4590) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4458) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4020) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4074) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4043) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4150) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4051) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4207) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4020) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4074) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4043) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4051) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4020) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6397) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6301) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6272) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6237) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6477) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.os.MessageQueue.nativePollOnce(Native Method) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.os.MessageQueue.next(MessageQueue.java:138) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.os.Looper.loop(Looper.java:123) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at android.app.ActivityThread.main(ActivityThread.java:5356) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at java.lang.reflect.Method.invokeNative(Native Method) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at java.lang.reflect.Method.invoke(Method.java:515) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081) 
08-28 10:19:05.486: E/AndroidRuntime(3041):  at dalvik.system.NativeStart.main(Native Method) 

回答

0

你需要聲明Activity HomePage是AndroidManifest.xml

<application 
     android:allowBackup="true" 
     android:icon="@drawable/logo" 
     android:theme="@style/AppTheme" > 

     . . . 
     <activity android:name="com.androidhive.xmlparsing.AndroidXMLParsingChamp" /> 
     . . . 
</application> 

更多細節

2

你都爭相推出AndroidXMLParsingChampdocumentation,但你還有其他的名字在Manifest聲明:AndroidXMLParsingActivityChamp。而且,你在那裏有重複的聲明。

+0

是的,這是問題,典型的我不尋找像這樣簡單的東西。謝謝! – Callum 2014-08-28 09:48:22

+0

如果這解決了你的問題,你應該考慮標記這是正確的答案 – Dreagen 2014-08-28 09:52:42

相關問題