Android 当我们选择“在开发人员中不保留活动”选项时,片段的意外行为
当select选项不在developer een中保留活动时,即使我在片段中声明了公共空构造函数,我也会遇到以下问题Android 当我们选择“在开发人员中不保留活动”选项时,片段的意外行为,android,android-fragments,Android,Android Fragments,当select选项不在developer een中保留活动时,即使我在片段中声明了公共空构造函数,我也会遇到以下问题 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.app/io.example.view.s.TestActivity}: android.support.v4.app.Fragment$InstantiationException: Unable
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.example.app/io.example.view.s.TestActivity}:
android.support.v4.app.Fragment$InstantiationException:
Unable to instantiate fragment io.example.view.s.TestActivity$TestFragment:
make sure class name exists, is public,
and has an empty constructor that is public
当我从一个活动转到另一个活动时,我会遇到这个例外
我把设备按了回去。您的
TestFragment
是否有公共默认构造函数(publictestfragment(){}
)?是的,我已经声明了它。