2013-05-18 67 views
0

我試圖將啓動畫面活動添加到我的Android應用程序,我正在做所有我在互聯網上看到的課程,但它不起作用。它總是說「不幸的是,*已停止。」可能是什麼原因?我無法用Android開機畫面啓動我的應用程序

謝謝..

我的主要活動

<code>package com.fckirbay.istatistikelkitap; 

import android.app.Activity; 
import android.content.Intent; 
import android.os.Bundle; 

public class MainActivity extends Activity { 

    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.acilis); 

     Thread thread = new Thread() { 

      @Override 
      public void run() { 

       try { 
        synchronized (this) { 
         wait(4000); 
        } 
       } catch (InterruptedException e) { 

        // Hata yönetimi 

       } finally { 

        finish(); 

        // Yeni açılmak istenen Intent 
        Intent intent = new Intent(); 
        intent.setClass(getApplicationContext(), acilis.class); 
        startActivity(intent); 

       } 

      } 
     }; 

     // Thread başlatılıyor 
     thread.start(); 

    } 
}</code> 

mysplash屏幕

package com.fckirbay.istatistikelkitap; 

import com.fckirbay.istatistikelkitap.R; 
import android.os.Bundle; 
import android.app.Activity; 
import android.content.Intent; 
import android.view.Menu; 
import android.view.View; 
import android.widget.Button; 


public class acilis extends Activity { 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_main); 
     Button tablolar=(Button)findViewById(R.id.tablolar); 
     Button istatistikciler=(Button)findViewById(R.id.istatistikciler); 
     Button unite1=(Button)findViewById(R.id.unite1); 
     Button unite2=(Button)findViewById(R.id.unite2); 
     Button unite3=(Button)findViewById(R.id.unite3); 
     Button unite4=(Button)findViewById(R.id.unite4); 
     Button unite5=(Button)findViewById(R.id.unite5); 
     Button unite6=(Button)findViewById(R.id.unite6); 
     Button devam=(Button)findViewById(R.id.devam); 

     devam.setOnClickListener(new View.OnClickListener() { 

      @Override 
      public void onClick(View v) { 
       // TODO Auto-generated method stub 
       startActivity(new Intent("com.fckirbay.istatistikelkitap.EKRANIKI")); 
      } 
     }); 

     tablolar.setOnClickListener(new View.OnClickListener() { 

      @Override 
      public void onClick(View v) { 
       // TODO Auto-generated method stub 
       startActivity(new Intent("com.fckirbay.istatistikelkitap.TABLOLAR")); 
      } 
     }); 

     istatistikciler.setOnClickListener(new View.OnClickListener() { 

      @Override 
      public void onClick(View v) { 
       // TODO Auto-generated method stub 
       startActivity(new Intent("com.fckirbay.istatistikelkitap.ISTATISTIKCILER")); 
      } 
     }); 

     unite1.setOnClickListener(new View.OnClickListener() { 

      @Override 
      public void onClick(View v) { 
       // TODO Auto-generated method stub 
       startActivity(new Intent("com.fckirbay.istatistikelkitap.UNITE1")); 
      } 
     }); 

     unite2.setOnClickListener(new View.OnClickListener() { 

      @Override 
      public void onClick(View v) { 
       // TODO Auto-generated method stub 
       startActivity(new Intent("com.fckirbay.istatistikelkitap.UNITE2")); 
      } 
     }); 

     unite3.setOnClickListener(new View.OnClickListener() { 

      @Override 
      public void onClick(View v) { 
       // TODO Auto-generated method stub 
       startActivity(new Intent("com.fckirbay.istatistikelkitap.UNITE3")); 
      } 
     }); 

     unite4.setOnClickListener(new View.OnClickListener() { 

      @Override 
      public void onClick(View v) { 
       // TODO Auto-generated method stub 
       startActivity(new Intent("com.fckirbay.istatistikelkitap.UNITE4")); 
      } 
     }); 

     unite5.setOnClickListener(new View.OnClickListener() { 

      @Override 
      public void onClick(View v) { 
       // TODO Auto-generated method stub 
       startActivity(new Intent("com.fckirbay.istatistikelkitap.UNITE5")); 
      } 
     }); 

     unite6.setOnClickListener(new View.OnClickListener() { 

      @Override 
      public void onClick(View v) { 
       // TODO Auto-generated method stub 
       startActivity(new Intent("com.fckirbay.istatistikelkitap.UNITE6")); 
      } 
     }); 





    } 



    @Override 
    public boolean onCreateOptionsMenu(Menu menu) { 
     // Inflate the menu; this adds items to the action bar if it is present. 
     getMenuInflater().inflate(R.menu.main, menu); 
     return true; 
    } 

} 

和活動清單

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

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

    <application 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme" > 
     <activity 
      android:name="com.fckirbay.istatistikelkitap.MainActivity" 
      android:label="@string/app_name" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

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

     <activity 
      android:name="com.fckirbay.istatistikelkitap.acilis" 
      android:label="@string/app_name" > 
      <intent-filter> 
       <action android:name="android.intent.action.ACILIS" /> 

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

    </application> 

</manifest> 
+0

你嘗試過什麼?你可以發佈一個簡化版本的源代碼來顯示問題嗎? –

+0

我貼了我的密碼.. –

回答

0

清單檔案中的應用程序入口點守ld是MainActivity。

應該在清單文件中看起來像這樣的東西。

<activity 
     android:name="com.example.MainActivity" 
     android:label="@string/app_name" android:screenOrientation="landscape" android:configChanges="keyboard|keyboardHidden|orientation" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

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

OK試試這個:

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

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

<application 
    android:allowBackup="true" 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" > 
    <activity 
     android:name="com.fckirbay.istatistikelkitap.MainActivity" 
     android:label="@string/app_name" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

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

    <activity android:name="Acilis" /> 

    </activity> 

</application> 

</manifest> 
+0

其實我有。對不起,我只發佈acilis活動。所以一定有另一個問題。 :(我編輯它 –

+0

<類別android:name =「android.intent.category.LAUNCHER」/>只與入口活動 –

+0

一起進行,實際上acilis中的「a」應該與您的課程名稱一樣小寫 –

0

問題是你定義了兩個發射活動。使您的Splash活動成爲您的LAUNCHER和您的MainActivity DEFAULT。

爲了您的飛濺活動:

<category android:name="android.intent.category.LAUNCHER" 

爲了您的主要活動:

<category android:name="android.intent.category.DEFAULT" 
相關問題