Type mismatch: cannot convert from MainFragment to Fragment 报错
源码:
FragmentTransaction mFragmentTranscation = getSupportFragmentManager().beginTransaction();
Fragment mMainFragment = new MainFragment();//此行提示出错
mFragmentTranscation.replace(R.id.container, mMainFragment);
mFragmentTranscation.commit();
错误提示:无法将MainFragment (Fragment的子类)强制转换成Fragment
解决方法:
在原来的MainFragment中把
import android.app.Fragment;
更改为:
import android.support.v4.app.Fragment;
Type mismatch: cannot convert from MainFragment to Fragment 报错的更多相关文章
- Type mismatch: cannot convert from java.sql.PreparedStatement to com.mysql.jdbc.PreparedStatement
Connection.prepareStatement()函数出错,提示: Type mismatch: cannot convert from java.sql.PreparedStatement ...
- Type mismatch: cannot convert from Enumeration<String> to Enumeration<Object>
完整的错误信息: Description Resource Path Location TypeType mismatch: cannot convert from Enumeration<St ...
- Type mismatch: cannot convert from javax.servlet.http.Cookie[] to org.apache.tomcat.util.http.parser.Cookie[] 的一种可能
今天用到Cookie时,写了一个Cookie数组,发现报错“Type mismatch: cannot convert from javax.servlet.http.Cookie[] to org. ...
- 报错:Type mismatch: cannot convert from Object to Car
问题描述: 一个非常简单的spring项目,用静态工厂方法配置bean实例.项目的目录结构如下: 代码如下: Car.java package com.tt.spring.beans.factory; ...
- java.lang.Error: Unresolved compilation problems: Syntax error on token "return", delete this token Type mismatch: cannot convert from Init to String
java.lang.Error: Unresolved compilation problems: Syntax error on token "return", delete ...
- input type=date时,时间数据回填,报错The specified value "2019-0404-18" does not conform to the required format, "yyyy-MM-dd".
<input autocomplete id="start-time" name="start_time" type="date" c ...
- 替换Fragment 报错 The specified child already has a parent. You must call removeView() on the child's parent first.
在将一个fragment替换到一个frameLayout的时候报错: code: transaction.replace(R.id.fragment_container, fragment2); 错误 ...
- Type mismatch: cannot convert from element type Object to String 解决办法
首先放上我的源码,看看你的代码是不是我这个类似的. @Test void predicateTest() throws Exception { List<String> languages ...
- The type org.springframework.jms.JmsException cannot be resolved报错解决
在调用JmsTemplate的send方法时,一直报编译时异常.如下: 异常提示是无法解析org.SpringFrawork.jms.JmsException类型.如下: The type org.s ...
随机推荐
- apache maven pom setting
<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Soft ...
- Java新集合示意图
Java的新集合实际上只有3个集合组件:①Map ②List ③Set 在Java 1.2后应该尽量避免使用Hashtable,Vector 和Stack: 假如在一个列表中部进行大量的插入和删除操作 ...
- GJM:书籍相关整理 [原创]
多人在线教程(中文)MultiplayerTutorial.pdf 链接: http://pan.baidu.com/s/1boDGGGZ 密码:9l2g 版权声明:本文原创发表于 ...
- 【GOF23设计模式】备忘录模式
来源:http://www.bjsxt.com/ 一.[GOF23设计模式]_备忘录模式.多点备忘.事务操作.回滚数据底层架构 package com.test.memento; /** * 源发器类 ...
- windows中安装node.js和测试
首先下载node.js安装包:下载页面:http://down.keleyi.com/goto/node.js.htm 选择windows msi安装包,根据自己操作系统选择32位或者64位安装包.然 ...
- 前端js文件合并三种方式
最近在思考前端js文件该如何合并,当然不包括不能合并文件,而是我们能合并的文件,想了想应该也只有三种方式. 三个方式如下: 1. 一个大文件,所有js合并成一个大文件,所有页面都引用它. 2. 各个页 ...
- 如何用JavaScript探测CSS动画是否已经完成
不啰嗦上代码: WN:(function(){ var el = $('<fakeelement>'), transition="transition", transi ...
- 错误 1 “System.Data.DataRow.DataRow(System.Data.DataRowBuilder)”不可访问,因为它受保护级别限制
new DataRow 的方式: DataTable pDataTable = new DataTable(); DataRow pRow = new DataRow(); 正确的方式: DataRo ...
- MS14-064 漏洞测试入侵win7
Microsoft Windows OLE远程代码执行漏洞,OLE(对象链接与嵌入)是一种允许应用程序共享数据和功能的技术, 远程攻击者利用此漏洞通过构造的网站执行任意代码,影响Win95+IE3 – ...
- OC单例快速实现
首先新建一个头文件,定义如下宏: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ...