源码:

  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;

Type mismatch: cannot convert from MainFragment to Fragment 报错的更多相关文章

  1. Type mismatch: cannot convert from java.sql.PreparedStatement to com.mysql.jdbc.PreparedStatement

    Connection.prepareStatement()函数出错,提示: Type mismatch: cannot convert from java.sql.PreparedStatement ...

  2. Type mismatch: cannot convert from Enumeration<String> to Enumeration<Object>

    完整的错误信息: Description Resource Path Location TypeType mismatch: cannot convert from Enumeration<St ...

  3. 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. ...

  4. 报错:Type mismatch: cannot convert from Object to Car

    问题描述: 一个非常简单的spring项目,用静态工厂方法配置bean实例.项目的目录结构如下: 代码如下: Car.java package com.tt.spring.beans.factory; ...

  5. 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 ...

  6. 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 ...

  7. 替换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); 错误 ...

  8. Type mismatch: cannot convert from element type Object to String 解决办法

    首先放上我的源码,看看你的代码是不是我这个类似的. @Test void predicateTest() throws Exception { List<String> languages ...

  9. The type org.springframework.jms.JmsException cannot be resolved报错解决

    在调用JmsTemplate的send方法时,一直报编译时异常.如下: 异常提示是无法解析org.SpringFrawork.jms.JmsException类型.如下: The type org.s ...

随机推荐

  1. Verilog学习笔记简单功能实现(五)...............序列检测设计

    这里采用夏宇闻教授第十五章的序列检测为例来学习; 从以上的状态转换图可以写出状态机的程序: module seqdet(x,out,clk,rst); input x,clk,rst; output ...

  2. 习题:codevs 2822 爱在心中 解题报告

    这次的解题报告是有关tarjan算法的一道思维量比较大的题目(真的是原创文章,希望管理员不要再把文章移出首页). 这道题蒟蒻以前做过,但是今天由于要复习tarjan算法,于是就看到codevs分类强联 ...

  3. MYSQL 解锁与锁表

    解锁 第一种 show processlist; 找到锁进程,kill id ; 第二种 mysql>UNLOCK TABLES; 锁表 锁定数据表,避免在备份过程中,表被更新 mysql> ...

  4. .Net中的并行编程-4.实现高性能异步队列

    上文<.Net中的并行编程-3.ConcurrentQueue实现与分析>分析了ConcurrentQueue的实现,本章就基于ConcurrentQueue实现一个高性能的异步队列,该队 ...

  5. Spring4学习笔记 - 配置Bean - 自动装配 关系 作用域 引用外部属性文件

    1 Autowire自动装配 1.1 使用:只需在<bean>中使用autowire元素 <bean id="student" class="com.k ...

  6. 04Mybatis_搭建Mybatis的开发环境

    第一步:导jia包: 1.导入Mybatis的核心jia包:

  7. HTML5 Maker – 在线轻松制作 HTML5 动画效果

    HTML5 Maker 是一个在线动画制作工具,帮助你使用 HTML,CSS 和 JavaScript 创建动态,互动的内容.它非常容易使用,同时可以帮你实现非常好的效果.它可以制作跨浏览器的动画内容 ...

  8. 微信中a链接无法进行跳转

    [问题]微信页面开发时,各个主页之间的跳转,完全是通过a链接进行的,但是来回跳转几次,再次从其他主页面跳回首页的时候,微信头部出现了跳转加载进度条,但是就是不跳转,也没有任何反应 [范围]只出现在微信 ...

  9. Client JQuery invoke NetSuite Suitelet

    Please indicate the source if you need to repost. Client jQuery could initialize a cross-domain requ ...

  10. MySQL sharding的几个参考地址

    http://stackoverflow.com/questions/5541421/mysql-sharding-approaches http://www.oschina.net/search?s ...