これが私が従ったyoutubeチュートリアルからのプロジェクト内のすべてのコードです。(メインセクション)ProjectActivity:
package justinehume.Project;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class ProjectActivity extends Activity{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button tut1 = (Button) findViewById(R.id.tutorial1);
tut1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
startActivity(new Intent("android.intent.action.TUTORIALONE"));
}
});
}
protected void onPause(){
super.onPause();
}
}
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical">
<Button android:id="@+id/tutorial1" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Button" />
</LinearLayout>
ProjectManifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="justinehume.Project"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".ProjectActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:label="@string/app_name"
android:name=".Tutorialone" >
<intent-filter >
<action android:name="android.intent.action.TUTORIALONE" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Tutorialone.java
package justinehume.Project;
import android.app.Activity;
import android.os.Bundle;
public class Tutorialone extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.tutorial1);
}
}
SDKでアプリを実行しているときにボタンをクリックするたびに、アプリがクラッシュし、強制的に閉じられます。何か案は?ありがとうございました!
Logcat
> 04-11 16:19:54.799: D/AndroidRuntime(344): Shutting down VM 04-11
> 16:19:54.809: W/dalvikvm(344): threadid=1: thread exiting with
> uncaught exception (group=0x4001d800) 04-11 16:19:54.819:
> E/AndroidRuntime(344): FATAL EXCEPTION: main 04-11 16:19:54.819:
> E/AndroidRuntime(344): android.content.ActivityNotFoundException: No
> Activity found to handle Intent {
> act=android.intent.action.TUTORIALONE } 04-11 16:19:54.819:
> E/AndroidRuntime(344): at
> android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1408)
> 04-11 16:19:54.819: E/AndroidRuntime(344): at
> android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
> 04-11 16:19:54.819: E/AndroidRuntime(344): at
> android.app.Activity.startActivityForResult(Activity.java:2817) 04-11
> 16:19:54.819: E/AndroidRuntime(344): at
> android.app.Activity.startActivity(Activity.java:2923) 04-11
> 16:19:54.819: E/AndroidRuntime(344): at
> justinehume.Project.ProjectActivity$1.onClick(ProjectActivity.java:23)
> 04-11 16:19:54.819: E/AndroidRuntime(344): at
> android.view.View.performClick(View.java:2408) 04-11 16:19:54.819:
> E/AndroidRuntime(344): at
> android.view.View$PerformClick.run(View.java:8816) 04-11 16:19:54.819:
> E/AndroidRuntime(344): at
> android.os.Handler.handleCallback(Handler.java:587) 04-11
> 16:19:54.819: E/AndroidRuntime(344): at
> android.os.Handler.dispatchMessage(Handler.java:92) 04-11
> 16:19:54.819: E/AndroidRuntime(344): at
> android.os.Looper.loop(Looper.java:123) 04-11 16:19:54.819:
> E/AndroidRuntime(344): at
> android.app.ActivityThread.main(ActivityThread.java:4627) 04-11
> 16:19:54.819: E/AndroidRuntime(344): at
> java.lang.reflect.Method.invokeNative(Native Method) 04-11
> 16:19:54.819: E/AndroidRuntime(344): at
> java.lang.reflect.Method.invoke(Method.java:521) 04-11 16:19:54.819:
> E/AndroidRuntime(344): at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
> 04-11 16:19:54.819: E/AndroidRuntime(344): at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 04-11
> 16:19:54.819: E/AndroidRuntime(344): at
> dalvik.system.NativeStart.main(Native Method)