.replace(R.id.container, new User()).commit();/The method replace(int, Fragment) in the type FragmentTransaction is not app
提示错误:The method replace(int, Fragment) in the type FragmentTransaction is not applicable for the arguments (int, MyFragment)
getFragmentManager().beginTransaction()
.replace(R.id.container, new User()).commit();
Fragment Activity导入的库不一样,导入一样的即可。
看图:http://www.cnblogs.com/xiaobo-Linux qq463431476

都导入 android.app Fragment;
V4的是兼容低版本的,目前4.4---5.0以上不需要;
http://www.cnblogs.com/xiaobo-Linux
.replace(R.id.container, new User()).commit();/The method replace(int, Fragment) in the type FragmentTransaction is not app的更多相关文章
- 错误:The method replace(int, Fragment) in the type FragmentTransaction is not applicable for the arguments (int, MyFragment)
Fragment newfragment =new MyFragment();fragmentTransaction.replace(R.layout.activity_main,newfragmen ...
- The method replace(int, Fragment, String) in the type FragmentTransaction is not applicable for the arguments (int, SettingFragment, String)
The method replace(int, Fragment, String) in the type FragmentTransaction is not applicable for the ...
- Andriod学习笔记2:“Your content must have a ListView whose id attribute is 'android.R.id.list'”问题的解决办法
问题描述 activity_main.xml代码如下: <?xml version="1.0" encoding="utf-8"?> <Lin ...
- Android Your content must have a ListView whose id attribute is 'android.R.id.list'错误的解决办法
在Android开发中,ListView有着很重要的地位,使用的场合也非常的多 错误提示:Your content must have a ListView whose id attribute is ...
- 初学时遇到的小问题Your content must have a ListView whose id attribute is 'android.R.id.list'
问题提出 错误提示:Your content must have a ListView whose id attribute is 'android.R.id.list' 关于解决Your conte ...
- findViewById(R.id.btn_first) 给写成 R.layout.
窗体内放了个按钮, findViewById(R.id.btn_first) 给写成 R.layout. 在java 里边引用结果就是找不到那个id 找了半天找不到原因, 奔着网上常见R找不到的问题, ...
- Library Project里面使用Case语句判断R.id值报错。case expressions must be constant expressions
原文地址:http://blog.csdn.net/wchinaw/article/details/7325641 在一般的Android项目里R里面的资源声明看起来是这样的: public stat ...
- Android java.lang.NoSuchFieldError: No static field xxx of type I in class Lcom/XX/R$id; or its superclasses
项目开发快到尾声,突然发现之前一个模块莫名其妙的奔溃了,我的内心也是奔溃的.以前一直都是好好的,也没去动过它,为啥会出现这样的问题呢? 下面我会根据自己的理解来看待问题 android是怎么根据id查 ...
- Android 找不到所标识的资源 java.lang.NoSuchFieldError: No static field XXX of type I in class Lcom/XX/R$id
报错: java.lang.NoSuchFieldError: No static field XXX of type I in class Lcom/XXX/R$id; or its supercl ...
随机推荐
- 使用Unified Communications Managed API获取Lync在线会议的链接地址
最近在项目上遇到一个问题,需要能够在程序中获取Lync会议的链接地址.Lync是微软出品的一套即时通信(IM)客户端软件,配合Microsoft Lync Server使用,其前身是Microsoft ...
- MySQL PXC构建一个新节点只需IST传输的方法
需求场景:原有的pxc环境数据量已经比较大,新买的服务器要加入此集群中,如何让其用IST的方式传输,而不是SST. PXC传输数据有两种方式: IST: Incremental State Trans ...
- Hibernate —— 映射关联关系(附录)
一.单向的多对一 1.建表语句 CREATE TABLE customer ( customer_id ) NOT NULL AUTO_INCREMENT PRIMARY KEY , ) CREATE ...
- Windows应用程序快捷方式创建工具
说明 在windows中经常用到将程序添加到桌面或者是开始菜单,乘着休息时间就做了这么一个快捷的工具. 程序展示: 用法 1. 命令行(CMD命令窗口) 命令: C:\Users\Administra ...
- C#冒泡排序法
基本原理 比较两个相邻的数的大小,每次比较完后把最大的数放到本轮的末尾.假设有数组: 258,445,131,97,22,36,17,38,28,28,第一轮:258和445比较,位置不用交换.第二轮 ...
- .NET正则表达式基础入门(一)
字符组 正则表达式的字符组十分简单,就是列出你所想要匹配的字符.阅读本章前,建议先下载我于CSDN上传的示例代码,下载无需分数,下载链接. 1.普通字符组 普通字符组,列出所有你需要匹配的字符. 例如 ...
- 用c#开发的一款webservice调用小工具,方便测试
本人经常与webservice打交道,webservice调用工具有soap ui,使用起来不是那么方便,所以我花了很长时间特意写了个小工具来调用Webservice方便测试,还有待进一步完善.使用方 ...
- 谁在关心toString的性能?
谁在关心toString的性能?没有人!除非当你有大量的数据在批量处理,使用toString产生了许多日志.然后,你去调查为何如此之慢,才意识到大部分的toString方法使用的是introspect ...
- win7下 VirtualBox虚拟机开机后台自启动
win7下安装个linux虚拟机,学习下非常好. 但是每次使用linux的时候,都是打开virtualBox-->启动安装的linux系统-->再用远程桌面(SSH等)连接 每次手动打开比 ...
- 从零开始学 Java - Spring AOP 实现主从读写分离
深刻讨论为什么要读写分离? 为了服务器承载更多的用户?提升了网站的响应速度?分摊数据库服务器的压力?就是为了双机热备又不想浪费备份服务器?上面这些回答,我认为都不是错误的,但也都不是完全正确的.「读写 ...