关于make sure class name exists, is public, and has an empty constructor that is public解决办法
来源:互联网 发布:软件提速精灵 编辑:程序博客网 时间:2024/05/18 01:30
Caused by: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.test.testFragment: make sure class name exists, is public, and has an empty constructor that is public
开发时候遇到一个这样的问题。说我的fragment没初始化。网上找了下资料
参考了http://www.tuicool.com/articles/nU7bAz
根据报错提示 “make sure class name exists, is public, and has an empty constructor that is public” ,若Fragement定义有带参构造函数,则一定要定义public的默认的构造函数。即可解决此问题。
除了他说的public.还有一个就是弄个空的构造函数。
例如我是这样定义了我的fragment。带有了构造函数
public TestFragment(int index){
mIndex = index;
}
然后我添加了一个这样的构造函数
public TestFragment(){
}
就解决了问题。
如果说的不对。或者有其他更好的建议 。请提出
0 0
- 关于make sure class name exists, is public, and has an empty constructor that is public解决办法
- Unable to instantiate fragment make sure class name exists, is public, and has an empty constructor
- Unable to instantiate fragment make sure class name exists, is public, and has an empty constructor
- Unable to instantiate fragment XXX make sure class name exists, is public, and has an empty constru
- Unable to instantiate fragment com.viewpager.demo.FirstFragment: make sure class name exists, is pub
- Cannot write to snapshot prefix '***'. Make sure that the directory exists and is writeable解决方法
- fatal: destination path '.' already exists and is not an empty directory. 错误及解决办法
- make sure that /opt/google/chrome/chrome-sandbox is owned by root and mode 4755
- could not find class file. make sure the file is compilable 解决办法
- fatal: destination path ‘文件夹名’ git clone already exists and is not an empty directory解决方法
- git fatal: destination path '**' already exists and is not an empty directory.解决
- Test class should have exactly one public constructor解决办法
- Test class should have public zero-argument constructor 解决办法
- android 关于Make sure the plugin is properly configured问题的解决办法
- android 关于Make sure the plugin is properly configured问题的解决办法
- android 关于Make sure the plugin is properly configured问题的解决办法
- android 关于Make sure the plugin is properly configured问题的解决办法
- android 关于Make sure the plugin is properly configured问题的解决办法
- 电商WMS与云仓储-E店宝-陈涛
- gdb调试命令
- apache+JK+tomcat负载均衡配置(windows)
- 大争之世,不在竞争中崛起,就在竞争中被吃掉
- 《Linux》天影linux系列笔记一——linux常用命令详解:gunzip
- 关于make sure class name exists, is public, and has an empty constructor that is public解决办法
- 利用监听器实现网站在线人数统计
- 多业务线受挫 小米深陷滑铁卢泥潭
- Linux笔记--5 --- shell脚本
- android UI 之shape
- Matlab调用DLL
- 对‘pthread_create’未定义的引用
- wifi softap(hotspot) porting
- 精简 mysq