2015-04-24 59 views
-2

它說我沒有發現我的啓動程序活動,當我明確地將啓動程序放在清單中時出於某種原因沒有定義,雖然它沒有啓動它。錯誤說沒有找到啓動程序的活動

public class SplashLaunch extends Activity{ 
    @Override 
    protected void onCreate(Bundle savedInstanceState){ 
     super.onCreate(savedInstanceState); 
     this.requestWindowFeature(Window.FEATURE_NO_TITLE); 
     this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); 
     setContentView(R.layout.splashlaunch); 
     final Main d = new Main(this); 
     new Handler().postDelayed(new Runnable() { 
      @Override 
      public void run() { 
       setContentView(d); 
      } 
     }, 5000); 
    } 

} 

這裏是清單文件。在這裏,你可以看到活動.LAUNCHER,但由於某種原因,它沒有打這個代碼或什麼?

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

    <uses-sdk 
     android:minSdkVersion="12" 
     android:targetSdkVersion="22" /> 

    <application 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme" > 
     <activity 
      android:name=".SplashLaunch" 
      android:label="@string/app_name" > 
      <intent-filter> 
       <action android:name="android.intent.action.SPLASHLAUNCH" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
     <activity 
      android:name=".YouFailed" 
      android:label="@string/app_name" > 
      <intent-filter> 
       <action android:name="android.intent.action.YOUFAILED" /> 

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

</manifest> 

回答

1

爲什麼你在過濾器中使用這些操作?

用途:

<action android:name="android.intent.action.MAIN" /> 
1

您使用不正確的動作android.intent.action.SPLASHLAUNCH

由此改變;

<activity 
    android:name=".SplashLaunch" 
    android:label="@string/app_name" > 
    <intent-filter> 
     <action android:name="android.intent.action.SPLASHLAUNCH" /> 

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

這樣:

<activity 
    android:name=".SplashLaunch" 
    android:label="@string/app_name" > 
    <intent-filter> 
     <action android:name="android.intent.action.MAIN" /> 

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

這不會opent的。主要類 –

+0

您需要在您使用類別指定動作''android.intent.action.MAIN' android.intent .category.LAUNCHER'。否則,您的應用程序的圖標將不會在應用程序啓動器中列出 –