我只是搞乱了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应用程序什么也没做什么大声笑....我已经宣布了意图,并且我已经检查了所有的名字并进行了双重检查......只是看不到树上的木头。任何帮助都会很棒。
答案 0 :(得分:0)
尝试,
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
Intent menuIntent = new Intent(MainActivity.this, JavaMenu.class);
startActivity(menuIntent);
}
}, 3000);
答案 1 :(得分: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>