2011-10-24 34 views
0

我有一個功能齊全的應用程序,如果你可以打電話給你的世界充分發揮功能。 有3個選項卡,每個選項都有所不同,並且在它之前會出現一個閃屏。Android Manifest Splash Hello World完成舞會

我想我犯了一個錯誤,試圖使用谷歌的API來得到一些GPS的東西,並以某種方式設法讓我的項目和備份版本。所以現在我只是試圖在將它們郵寄給我的講師之前將它們全部重新裝回。

問題:當設置運行配置啓動飛濺時,飛濺完成時會出現一些錯誤。我是一個完全新手,所以我不知道什麼是我的代碼剩下的部分是錯的。我懷疑它的清單或splash代碼意圖指針thingy。

logcat的

10-24 05:28:08.297: D/dalvikvm(612): GC_EXTERNAL_ALLOC freed 673 objects/52920 bytes in 136ms 
10-24 05:28:13.185: W/dalvikvm(612): threadid=7: thread exiting with uncaught exception (group=0x4001d800) 
10-24 05:28:13.195: E/AndroidRuntime(612): FATAL EXCEPTION: Thread-8 
10-24 05:28:13.195: E/AndroidRuntime(612): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.b00517566.helloworldfinal/com.b00517566.helloworld.HelloWorldfinalActivity}; have you declared this activity in your AndroidManifest.xml? 
10-24 05:28:13.195: E/AndroidRuntime(612): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1404) 
10-24 05:28:13.195: E/AndroidRuntime(612): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378) 
10-24 05:28:13.195: E/AndroidRuntime(612): at android.app.Activity.startActivityForResult(Activity.java:2817) 
10-24 05:28:13.195: E/AndroidRuntime(612): at android.app.Activity.startActivity(Activity.java:2923) 
10-24 05:28:13.195: E/AndroidRuntime(612): at com.b00517566.helloworldfinal.splash$1.run(splash.java:37) 

清單

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

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

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

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

     <activity android:name="ButtonTab"> 
      <intent-filter></intent-filter> 
     </activity> 
     <activity android:name="MiscTab"> 
      <intent-filter></intent-filter> 
     </activity> 
     <activity android:name="RadioBtnsTab"> 
      <intent-filter></intent-filter> 
     </activity> 


    </application> 

</manifest> 

飛濺

public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.splash); 


     // thread for displaying the SplashScreen 
     Thread splashTread = new Thread() { 
      @Override 
      public void run() { 
       try { 
        int waited = 0; 
        while(_active && (waited < _splashTime)) { 
         sleep(100); 
         if(_active) { 
          waited += 100; 
         } 
        } 
       } catch(InterruptedException e) { 
        // do nothing 
       } finally { 
        finish(); 
        Intent i = new Intent(); 
        i.setClassName("com.b00517566.helloworldfinal", 
"com.b00517566.helloworld.HelloWorldfinalActivity"); 
        startActivity(i); 
        //startActivity(new Intent("com528.b00517566.helloworld")); 
        // stop(); 
       } 
      } 
     }; 
     splashTread.start(); 


    } 

回答

1

錯誤說,它不能找到 「HelloWorldfinalActivity」 和你的清單定義 「HelloWorldFinalActivity」 - 在小寫的F第一種情況,大寫字母F在第二種情況下。

您在清單中的活動名稱應與您爲活動提供'。'的類名相同。在他們面前。例如,如果您有HelloWorldFinalActivity.class,則清單中的名稱應該是「.HelloWorldFinalActivity」。

此外,還有開始的活動更直接的方式:

Intent i = new Intent(CurrentActivityName.this, com.b00517566.helloworldfinal.HelloWorldFinalActivity.class) 
startActivity(i); 

與類此此代碼是在名稱替換CurrentActivityName

+0

非常感謝 – TroothHertz