0

当我只是在搞乱android编程时,我得到了标题中的错误:

代码 :

package co.uk.mypchealth.whatami;

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


public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Thread logoTimer = new Thread(){
            public void run(){
                try {
                       sleep(3000);
                       Intent menuIntent = new Intent("co.uk.mypchealth.whatami.JAVAMENU");
                       startActivity(menuIntent);
                } 
                catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                finally{
                    finish();
                }
            }
        };
        logoTimer.start();
    }

    @Override
    protected void onPause() {
        // TODO Auto-generated method stub
        super.onPause();
    }
}

和清单:

  <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="co.uk.mypchealth.whatami"
        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="co.uk.mypchealth.whatami.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=".JavaMenu"
                android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="co.uk.mypchealth.whatami.JAVAMENU" />
                    <category android:name="android.intent.category.DEFUALT" />
                </intent-filter>
            </activity>

        </application>

</manifest>

我希望它的一些简单的东西我的意思是 jeeze 该应用程序还没有做任何事情大声笑......我已经声明了意图,并且我已经检查并仔细检查了所有名称......只是看不到树上的木头。任何帮助都会很棒。

4

2 回答 2

0

尝试,

    Handler handler = new Handler();
    handler.postDelayed(new Runnable() {

    @Override
    public void run() {
     Intent menuIntent = new Intent(MainActivity.this, JavaMenu.class);
     startActivity(menuIntent);
        }
        }, 3000);
于 2013-07-02T11:55:30.607 回答
0

尝试这个 :

        <activity
            android:name=".JavaMenu"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="co.uk.mypchealth.whatami.JAVAMENU" />
                <category android:name="android.intent.category.DEFUALT" />
            </intent-filter>
        </activity>

您已在两个活动中定义了应用程序名称尝试将此活动声明更改为:

 <activity   android:name="co.uk.mypchealth.whatami.JavaMenu" >    </activity>
于 2013-07-02T12:01:26.960 回答