ActivityNotFoundException:找不到处理Intent的活动{act = splashscreen.app.test.CLEARSCREEN}?

时间:2012-07-07 07:48:38

标签: android android-intent

即时通讯这个问题..基本上这是一个简单的创建启动画面但是加载启动画面我想加载主窗体但是这里有这个问题............我添加了要表现出来的活动...... 这是我的java代码

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
        setContentView(R.layout.splash);
        Thread logotimer=new Thread(){
            public void run()
            {
            try
            {
                int timer=0;
                while(timer<5000)
                {
                    sleep(100);
                    timer=timer+100;

                }
                startActivity(new Intent("splashscreen.app.test.CLEARSCREEN"));
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            finally
            {
                finish();
            }

            }
        };
        logotimer.start();

    }
}

这里有明显的活动我包括

 <application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <activity
        android:name=".SplashscreenActivity"
        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=".menu"
        android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.CLEARSCREEN" />

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

2 个答案:

答案 0 :(得分:1)

将此行startActivity(new Intent("splashscreen.app.test.CLEARSCREEN"));更改为

startActivity(new Intent(YourActivity.this,SecondActivity.class));

有关您的信息,请勿在将来使用“活动”或“班级名称”作为菜单。

你明显使用,

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

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

<activity 
        android:name=".menu"/>

请参阅本教程以制作启动画面http://www.codeproject.com/Articles/113831/An-Advanced-Splash-Screen-for-Android-App

答案 1 :(得分:0)

使用此:

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <activity
        android:name=".SplashscreenActivity"
        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=".menu"
        android:label="@string/app_name">
    </activity>
</application>

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splash);
    Thread logotimer=new Thread(){
        public void run()
        {
        try
        {
            int timer=0;
            while(timer<5000)
            {
                sleep(100);
                timer=timer+100;

            }
            Intent intent = new Intent(YourSplashActivityName.this,TagetActivityName.class);
            startActivity(intent);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        finally
        {
            finish();
        }

        }
    };
    logotimer.start();

}