2014-02-23 23 views
0

我有程序,有splassh頁面我用我的飛濺actıvıty我的maınactıvıty文件夾,但是當我運行我的程序,我停止後我的飛濺 這裏是我的飛濺類和manıfest xml和我的logcat我不能傳遞到我的其他活動

package com.tesbih; 

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

    public class Splash extends Activity { 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     // TODO Auto-generated method stub 
     super.onCreate(savedInstanceState); 

     setContentView(R.layout.splash); 
     Thread timer = new Thread(){ 

      public void run(){ 
       try{ 
        sleep(5000); 
       }catch(InterruptedException e){ 

        e .printStackTrace(); 

       }finally{ 

    Intent openStartingPoint = new Intent ("com.tesbih.TESBIHMAINACTIVITY"); 
    startActivity(openStartingPoint); 

       } 
      } 
     }; 

     timer.start(); 
    } 





    } 




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

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

    <application 
    android:allowBackup="true" 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" > 
    <activity 
     android:name="com.tesbih.TesbihMainActivity" 
     android:label="@string/app_name" > 
     <intent-filter> 
      <action android:name="android.intent.action.TESBIHMAINACTIVITY" /> 
      <category android:name="android.intent.category.DEFAULT" /> 
     </intent-filter> 
    </activity> 


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

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


    </application> 

    </manifest> 

    moreover here ıs my logcat 

02-23 20:33:40.713:E/AndroidRuntime(5683)android.content.ActivityNotFoundException:無活動發現處理意圖{行爲= com.tesbih.TESBIHMAINACTIVITY}

+0

的那顯示的是活動在你的清單中? – Merlevede

+0

decalre TESBIHMAINACTIVITY在清單中 – KOTIOS

回答

1

您可以複製並粘貼到下面

package com.tesbih; 

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

public class Splash extends Activity { 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     // TODO Auto-generated method stub 
     super.onCreate(savedInstanceState); 

     setContentView(R.layout.splash); 
     Thread timer = new Thread(){ 

      public void run(){ 
       try{ 
        sleep(3000); 
       }catch(InterruptedException e){ 

        e.printStackTrace(); 

       }finally{ 

        Intent i = new Intent (Splash.this,TesbihMainActivity.class); 
        startActivity (i);       
       } 
      }  
     }; 
     timer.start(); 
    } 
} 
1

開始你的活動,

Intent openStartingPoint = new Intent (Splash.this,TesbihMainActivity.class); 
startActivity(openStartingPoint); 

而不是定時器,你也可以使用處理程序飛濺。

new Handler().postDelayed(new Runnable() { 

      @Override 
      public void run() { 
       Intent i = new Intent(SplashScreen.this, TesbihMainActivity.class); 
       startActivity(i); 

       // close splash 
       finish(); 
      } 
}, SPLASH_TIME_OUT); 
1

android:name="com.tesbih.TesbihMainActivity"
您在清單上面有那麼你必須在splash.java改變 ("com.tesbih.TESBIHMAINACTIVITY");("com.tesbih.TesbihMainActivity");

相關問題