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 ...
随机推荐
- 《高可用MySQL》1 – Windows环境下压缩版MySQL安装
近日在读O’REILIY系列的<高可用MySQL>, 自然少不了主从(Master-Slave)配置和横向扩展相关的内容.Master-Slave这东西吧,在许多公司都是标配,开发中基本天 ...
- HTTP错误大全 404 200 501 502 505
HTTP错误 大全 403 401 400 404 304 200 HTTP 400 - 请求无效 HTTP 401.1 - 未授权:登录失败 HTTP 401.2 - 未授权:服务器配置问题导致登录 ...
- HTML5 Canvas 实现的9个 Loading 效果
Sonic.js 是一个很小的 JavaScript 类,用于创建基于 HTML5 画布的加载图像.更强大的是 Sonic.js 还提供了基于现成的例子的创建工具,可以帮助你实现更多自定义的(Load ...
- 【CSS3】 理解CSS3 transform中的Matrix(矩阵)
理解CSS3 transform中的Matrix(矩阵) by zhangxinxu from http://www.zhangxinxu.com 本文地址:http://www.zhangxinxu ...
- JQuery插件Validation的使用-遁地龙卷风
第二版 (-1)写在前面 本文不是要详细说明Validation插件的使用,而是将满足开发需求的代码已最应该使用的方式写出来,并附有详细的注释 想要了解更多,去jquery的官网,有最新,最全面的,后 ...
- HTML <hr /> 标签 在页面中创建一条水平线
一,定义和用法 <hr /> 标签在 HTML 页面中创建一条水平线. 水平分隔线(horizontal rule)可以在视觉上将文档分隔成各个部分. 二,HTML 与 XHTML 之间的 ...
- ArcGis 001270 : 合并数据失败
描述 工具无法将服务所需的数据和资源打包. 如果用于发布 GIS 资源的路径或要向服务器复制的数据的路径大小超出了操作系统的限制,则当您向 ArcGIS 服务器复制数据时会发生此错误. 此路径包括过渡 ...
- sharepoint:找不到位于 http://XX.XX.XX.XX 的 Web
自己写了个sharepoint的webservice,发不到IIS上后报错: System.IO.FileNotFoundException: 找不到位于 http://XX.XX.XX.XX 的 W ...
- Android View各种尺寸位置相关的方法探究
Android View各种尺寸位置相关的方法探究 本来想做一个View间的碰撞检测之类的. 动手做了才发现不是想象的那么简单. 首先,写好了碰撞检测的工具类如下: package com.mengd ...
- Android 手机卫士--签名文件说明&包名说明
在<Android 手机卫士--打包生成apk维护到服务器>一文中,实现了新版本的apk到服务器,当打开客户端apk的时候,发现有新版本,提示更新.还实现了利用xutils工具实现了从服务 ...