のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

DialogFragmentの回転

dialogfragmentで回転すると、死ぬ。

FATAL EXCEPTION: main
Process: jp.co.android.eval, PID: 8580
java.lang.RuntimeException: Unable to start activity ComponentInfo
 {jp.co.android.eval/jp.co.android.eval.MainActivity}: 
 android.app.Fragment$InstantiationException:
 Unable to instantiate fragment jp.co.android.eval.CodeFragment$1MainFragmentDialog: 
 make sure class name exists, is public, and has an empty constructor that is public
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2176)
	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
	at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3719)
	at android.app.ActivityThread.access$800(ActivityThread.java:135)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1403)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loop(Looper.java:137)
	at android.app.ActivityThread.main(ActivityThread.java:4998)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:515)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
	at dalvik.system.NativeStart.main(Native Method)
Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment jp.co.android.eval.CodeFragment$1MainFragmentDialog: make sure class name exists, is public, and has an empty constructor that is public
	at android.app.Fragment.instantiate(Fragment.java:601)
	at android.app.FragmentState.instantiate(Fragment.java:98)
	at android.app.FragmentManagerImpl.restoreAllState(FragmentManager.java:1759)
	at android.app.Activity.onCreate(Activity.java:898)
	at jp.co.android.eval.MainActivity.onCreate(MainActivity.java:15)
	at android.app.Activity.performCreate(Activity.java:5243)
	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2140)
	... 12 more
Caused by: java.lang.InstantiationException: can't instantiate class jp.co.android.eval.CodeFragment$1MainFragmentDialog; no empty constructor
	at java.lang.Class.newInstanceImpl(Native Method)
	at java.lang.Class.newInstance(Class.java:1208)
	at android.app.Fragment.instantiate(Fragment.java:590)
	... 19 more

【Android】DialogFragmentを使ってみる - Furudateのブログ

Android - NumberPickerダイアログのカスタマイズ - Qiita