私はAndroidアプリ開発の初心者で、最初のアプリを作成しようとしています。別のアクティビティを表示したいときに、アプリが次のログ(LogCatから取得)でクラッシュします。
02-01 18:05:50.148: D/HomeScreen(24970): news_button clicked
02-01 18:05:50.203: D/dalvikvm(24970): newInstance failed: p0 i0 [0 a1
02-01 18:05:50.210: D/AndroidRuntime(24970): Shutting down VM
02-01 18:05:50.210: W/dalvikvm(24970): threadid=1: thread exiting with uncaught exception (group=0x40018578)
02-01 18:05:50.218: E/AndroidRuntime(24970): FATAL EXCEPTION: main
02-01 18:05:50.218: E/AndroidRuntime(24970): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{me.the_Seppi.freakhall/me.the_Seppi.freakhall.NewsScreen}: java.lang.InstantiationException: me.the_Seppi.freakhall.NewsScreen
02-01 18:05:50.218: E/AndroidRuntime(24970): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1573)
02-01 18:05:50.218: E/AndroidRuntime(24970): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
02-01 18:05:50.218: E/AndroidRuntime(24970): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
02-01 18:05:50.218: E/AndroidRuntime(24970): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
02-01 18:05:50.218: E/AndroidRuntime(24970): at android.os.Handler.dispatchMessage(Handler.java:99)
02-01 18:05:50.218: E/AndroidRuntime(24970): at android.os.Looper.loop(Looper.java:130)
02-01 18:05:50.218: E/AndroidRuntime(24970): at android.app.ActivityThread.main(ActivityThread.java:3687)
02-01 18:05:50.218: E/AndroidRuntime(24970): at java.lang.reflect.Method.invokeNative(Native Method)
02-01 18:05:50.218: E/AndroidRuntime(24970): at java.lang.reflect.Method.invoke(Method.java:507)
02-01 18:05:50.218: E/AndroidRuntime(24970): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
02-01 18:05:50.218: E/AndroidRuntime(24970): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
02-01 18:05:50.218: E/AndroidRuntime(24970): at dalvik.system.NativeStart.main(Native Method)
02-01 18:05:50.218: E/AndroidRuntime(24970): Caused by: java.lang.InstantiationException: me.the_Seppi.freakhall.NewsScreen
02-01 18:05:50.218: E/AndroidRuntime(24970): at java.lang.Class.newInstanceImpl(Native Method)
02-01 18:05:50.218: E/AndroidRuntime(24970): at java.lang.Class.newInstance(Class.java:1409)
02-01 18:05:50.218: E/AndroidRuntime(24970): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
02-01 18:05:50.218: E/AndroidRuntime(24970): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1565)
02-01 18:05:50.218: E/AndroidRuntime(24970): ... 11 more
実行されるコードは次のとおりです。
//HomeScreen.java
//...
public void gotoNews (View view) {
Log.d(TAG, "news_button clicked");
Intent news = new Intent(this, NewsScreen.class);
startActivity(news);
}
//NewsScreen.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_news_screen);
Log.d("NewsScreen", "created");
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.update_text).setTitle(R.string.update_title).create().show();
Log.d("NewsScreen", "Started update");
}
ログに行番号がないため、コードにエラーが見つかりません。私を助けてください。