ボタンをクリックした後、別のページに移動したい。しかし、私はちょうどエラーが発生します。これは私のコードです:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_anime_paradise_t1);
Button list = (Button) findViewById(R.id.list);
list.setText("List");
list.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(AnimeParadiseT1.this, View.class);
startActivity(intent);
}
});
そしてView
クラスで:
public class View extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.list);
}
}
とても奇妙です。私のlogCatも見てください:
08-29 00:12:32.910: D/AndroidRuntime(1582): Shutting down VM
08-29 00:12:32.910: W/dalvikvm(1582): threadid=1: thread exiting with uncaught exception (group=0x40203560)
08-29 00:12:32.920: E/AndroidRuntime(1582): FATAL EXCEPTION: main
08-29 00:12:32.920: E/AndroidRuntime(1582): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.animeparadise/android.view.View}; have you declared this activity in your AndroidManifest.xml?
08-29 00:12:32.920: E/AndroidRuntime(1582): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405)
08-29 00:12:32.920: E/AndroidRuntime(1582): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
08-29 00:12:32.920: E/AndroidRuntime(1582): at android.app.Activity.startActivityForResult(Activity.java:2827)
08-29 00:12:32.920: E/AndroidRuntime(1582): at android.app.Activity.startActivity(Activity.java:2933)
08-29 00:12:32.920: E/AndroidRuntime(1582): at com.animeparadise.AnimeParadiseT1$1.onClick(AnimeParadiseT1.java:29)
08-29 00:12:32.920: E/AndroidRuntime(1582): at android.view.View.performClick(View.java:2506)
08-29 00:12:32.920: E/AndroidRuntime(1582): at android.view.View$PerformClick.run(View.java:9112)
08-29 00:12:32.920: E/AndroidRuntime(1582): at android.os.Handler.handleCallback(Handler.java:587)
08-29 00:12:32.920: E/AndroidRuntime(1582): at android.os.Handler.dispatchMessage(Handler.java:92)
08-29 00:12:32.920: E/AndroidRuntime(1582): at android.os.Looper.loop(Looper.java:130)
08-29 00:12:32.920: E/AndroidRuntime(1582): at android.app.ActivityThread.main(ActivityThread.java:3835)
08-29 00:12:32.920: E/AndroidRuntime(1582): at java.lang.reflect.Method.invokeNative(Native Method)
08-29 00:12:32.920: E/AndroidRuntime(1582): at java.lang.reflect.Method.invoke(Method.java:507)
08-29 00:12:32.920: E/AndroidRuntime(1582): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
08-29 00:12:32.920: E/AndroidRuntime(1582): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
08-29 00:12:32.920: E/AndroidRuntime(1582): at dalvik.system.NativeStart.main(Native Method)
08-29 00:12:34.061: I/Process(1582): Sending signal. PID: 1582 SIG: 9
そしてもう1つ。View
クラスを として定義するだけActivity
です。