NewBostonチュートリアルを使用してAndroidアプリケーション開発を学んでいます。レッスン21を完了しましたが、コードを実行すると、スプラッシュ画面(つまりロゴ)の後にアプリケーションがクラッシュします。助けてください。このチュートリアルを終了したくありません。以下のデータ以外にEclipseから必要なものがあれば、私に知らせてください。前もって感謝します。
私のマニフェスト:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.thenewboston.pok"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".Splash"
android:label="@string/title_activity_the_new_boston" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".TheNewBostonActivity"
android:label="@string/title_activity_the_new_boston" >
<intent-filter>
<action android:name="com.thenewboston.pok.THENEWBOSTONACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".MENU"
android:label="@string/title_activity_the_new_boston" >
<intent-filter>
<action android:name="com.thenewboston.pok.MENU" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
My Menu.java:
package com.thenewboston.pok;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class Menu extends ListActivity{
String classes[]={"TheNewBostonActivity", "example1", "example2", "example3",
"example4", "example5", "example6"};
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(Menu.this, android.R.layout.simple_list_item_1, classes));
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
String cheese = classes[position];
try{
Class ourClass = Class.forName("com.thenewboston.pok." + cheese);
Intent ourIntent = new Intent(Menu.this, ourClass);
startActivity(ourIntent);
} catch (ClassNotFoundException e){
e.printStackTrace();
}
}
}
私のSplash.java:
package com.thenewboston.pok;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class Splash extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Thread timer = new Thread(){
public void run() {
try{
sleep(5000);
}catch (InterruptedException e){
e.printStackTrace();
}finally{
Intent open1= new Intent ("com.thenewboston.pok.MENU");
startActivity(open1);
}
}
};
timer.start();
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
}
}
私のTheNewBostonActivity.java:
package com.thenewboston.pok;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class TheNewBostonActivity extends Activity {
MediaPlayer ourSong;
int counter;
Button add, sub;
TextView display;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ourSong = MediaPlayer.create(TheNewBostonActivity.this, R.raw.undisclosed_desires);
ourSong.start();
counter = 0;
add = (Button) findViewById(R.id.bAdd);
sub = (Button) findViewById(R.id.bSub);
display = (TextView) findViewById(R.id.tvDisplay);
add.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
counter++;
display.setText("Your Total Is " + counter);
}
});
sub.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
counter--;
display.setText("Your Total Is " + counter);
}
});
}
@Override
protected void onStop() {
// TODO Auto-generated method stub
super.onStop();
ourSong.release();
}
}
私のログファイル:
09-25 14:56:56.778: D/AndroidRuntime(336): Shutting down VM
09-25 14:56:56.778: W/dalvikvm(336): threadid=1: thread exiting with uncaught exception (group=0x40015560)
09-25 14:56:56.797: E/AndroidRuntime(336): FATAL EXCEPTION: main
09-25 14:56:56.797: E/AndroidRuntime(336): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.thenewboston.pok/com.thenewboston.pok.MENU}: java.lang.ClassNotFoundException: com.thenewboston.pok.MENU in loader dalvik.system.PathClassLoader[/data/app/com.thenewboston.pok-1.apk]
09-25 14:56:56.797: E/AndroidRuntime(336): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
09-25 14:56:56.797: E/AndroidRuntime(336): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
09-25 14:56:56.797: E/AndroidRuntime(336): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
09-25 14:56:56.797: E/AndroidRuntime(336): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
09-25 14:56:56.797: E/AndroidRuntime(336): at android.os.Handler.dispatchMessage(Handler.java:99)
09-25 14:56:56.797: E/AndroidRuntime(336): at android.os.Looper.loop(Looper.java:123)
09-25 14:56:56.797: E/AndroidRuntime(336): at android.app.ActivityThread.main(ActivityThread.java:3683)
09-25 14:56:56.797: E/AndroidRuntime(336): at java.lang.reflect.Method.invokeNative(Native Method)
09-25 14:56:56.797: E/AndroidRuntime(336): at java.lang.reflect.Method.invoke(Method.java:507)
09-25 14:56:56.797: E/AndroidRuntime(336): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
09-25 14:56:56.797: E/AndroidRuntime(336): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
09-25 14:56:56.797: E/AndroidRuntime(336): at dalvik.system.NativeStart.main(Native Method)
09-25 14:56:56.797: E/AndroidRuntime(336): Caused by: java.lang.ClassNotFoundException: com.thenewboston.pok.MENU in loader dalvik.system.PathClassLoader[/data/app/com.thenewboston.pok-1.apk]
09-25 14:56:56.797: E/AndroidRuntime(336): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
09-25 14:56:56.797: E/AndroidRuntime(336): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
09-25 14:56:56.797: E/AndroidRuntime(336): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
09-25 14:56:56.797: E/AndroidRuntime(336): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
09-25 14:56:56.797: E/AndroidRuntime(336): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
09-25 14:56:56.797: E/AndroidRuntime(336): ... 11 more