Type mismatch: cannot convert from MainFragment to Fragment 报错
来源:互联网 发布:逛淘宝网 编辑:程序博客网 时间:2024/05/21 08:48
源码:
1 FragmentTransaction mFragmentTranscation = getSupportFragmentManager().beginTransaction();2 Fragment mMainFragment = new MainFragment();//此行提示出错3 mFragmentTranscation.replace(R.id.container, mMainFragment);4 mFragmentTranscation.commit();
错误提示:无法将MainFragment (Fragment的子类)强制转换成Fragment
解决方法:
在原来的MainFragment中把
import android.app.Fragment;
更改为:
import android.support.v4.app.Fragment;
0 0
- Type mismatch: cannot convert from MainFragment to Fragment 报错
- Type mismatch: cannot convert from MainFragment to Fragment 报错
- Type mismatch: cannot convert from MainFragment to Fragment 报错
- Type mismatch: cannot convert from CharFragment to Fragment错误
- Type mismatch: cannot convert from Integer to int(java 报错)
- 报错信息:Type mismatch: cannot convert from org.hibernate.Transaction to javax.transaction.Transaction
- junit Type mismatch: cannot convert from Test to Annotation
- Type mismatch: cannot convert from Test to Annotation
- Id Type mismatch: cannot convert from connection to connection
- Type mismatch: cannot convert from Object to String
- Type mismatch: cannot convert from Enumeration<String> to Enumeration<Object>
- Type mismatch: cannot convert from Test to Annotation
- Type mismatch: cannot convert from Object to String
- Type mismatch: cannot convert from Test to Annotation
- Hibernate Type mismatch: cannot convert from CascadeType to CascadeType[]
- Type mismatch: cannot convert from Test to Annotation
- 解决Type mismatch: cannot convert from ByteMatrix to BitMatrix
- 关于 Type mismatch: cannot convert from Integer to int
- C#连接Access数据库连接类
- 夹娃多项式展开
- OC语言@property @synthesize和id
- 泛型list直接转换成制定类型的数组报强制转换错误
- Android--文件保存与读取
- Type mismatch: cannot convert from MainFragment to Fragment 报错
- Android点击触摸机制备忘
- 网络编程学习(九)
- jQuery实战笔记(二)-创建元素包装集
- Lucence(Index,Searcher,Analyzer)技术原理整理
- iOS中添加UITapGestureRecognizer手势识别后,UITableView的didSelectRowAtIndexPath失效
- iOS开发数据库篇—2.Sqlite常用语句及功能
- 智捷公开课马上开始了-欢迎大家一起讨论学习-第一系列读《Swift开发指南(修订版) 》看Swift视频教程
- 视频基础之线程通讯