尝试更改活动时出现错误。它曾经工作,但我不知道发生了什么。
我查看了第 25 行,但看不出有什么问题。难道我做错了什么?
02-07 20:05:02.414: E/AndroidRuntime(1278): FATAL EXCEPTION: Thread-105
02-07 20:05:02.414: E/AndroidRuntime(1278): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.MainActivity }
02-07 20:05:02.414: E/AndroidRuntime(1278): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1622)
02-07 20:05:02.414: E/AndroidRuntime(1278): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
02-07 20:05:02.414: E/AndroidRuntime(1278): at android.app.Activity.startActivityForResult(Activity.java:3370)
02-07 20:05:02.414: E/AndroidRuntime(1278): at android.app.Activity.startActivityForResult(Activity.java:3331)
02-07 20:05:02.414: E/AndroidRuntime(1278): at android.app.Activity.startActivity(Activity.java:3566)
02-07 20:05:02.414: E/AndroidRuntime(1278): at android.app.Activity.startActivity(Activity.java:3534)
02-07 20:05:02.414: E/AndroidRuntime(1278): at com.example.quizapp.Splash$1.run(Splash.java:25)
这是我的 Splash.java 类:
package com.example.quizapp;
import com.example.quizapp.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class Splash extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Thread t1 = new Thread() {
public void run() {
try {
sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
Intent openMainActivity = new Intent(
"android.intent.action.MainActivity");
startActivity(openMainActivity);
}
}
};
t1.start();
}
@Override
protected void onPause() {
super.onPause();
finish();
}
}