android fragment addToBackStack bug
In FragmentActivity。First, I add two fragment by FragmentTransaction。
See the flowing code :
/******************************************************/
MyFragmentManager manager;
FragmentTransaction fragmentTransaction;
FragmentManager fragmentManager;
MainBottomFragment bottom;
fragmentManager = getSupportFragmentManager();
fragmentTransaction = fragmentManager.beginTransaction();
manager = new MyFragmentManager(this);
Fragment bottomFragment = new MainBottomFragment(this);
Fragment homePageFragment= new HomePageFragment(this);
fragmentTransaction.add(R.id.common_bottom, bottomFragment);
fragmentTransaction.add(R.id.common_top, homePageFragment= );
fragmentTransaction.commit();
/******************************************************/
Second,In homePageFragment fragment,I need to deal with one button click event to next fragment(A),
then in Fragment,I processing then:
/******************************************************/
getSupportFragmentManager().beginTransaction().addToBackStack(null).replace(R.id.common_top, A);
/******************************************************/
Third,In A fragment,I need to deal with one button click event to next fragment(B),
then in Fragment,I processing then:
/******************************************************/
getSupportFragmentManager().beginTransaction().addToBackStack(null).replace(R.id.common_top,B);
/******************************************************/
Fouth,now B fragment is in the top,When I press the return key, the current fragment's order is
B->A->homeFragment,there is not problem with the above four stops;
But in the second step,if you replace fragment without call addToBackStack(null) method,like this:
getSupportFragmentManager().beginTransaction().replace(R.id.common_top, A);
When the top fragment is B,When I press the return key, the current fragment's order is
B->homeFragment accourding to Google's official Android documentation,But is not consistent with what I expected。
Is anybody call tell me why? How do I solve this problem?
thans a lot.
android fragment addToBackStack bug的更多相关文章
- Android Fragment 生命周期及其API使用(建议使用自定义View替换Fragment)
我为什么不主张使用Fragment Fragment:( Fragment就相当于一个有生命周期的View,它的生命周期被所在的Activity的生命周期管理 ) 生命周期回调说明: onAttach ...
- Android Fragment 生命周期及其正确使用(建议使用自定义View替换Fragment)
使用Fragment 官方例子中显示: 例如:一个学生Fragment,需要传入studentId,进行http请求显示,那么setArguments后防止杀掉Fragment后,参数为0,显示不了数 ...
- 【Android自学日记】【转】Android Fragment 真正的完全解析(下)
上篇博客中已经介绍了Fragment产生原因,以及一些基本的用法和各种API,如果你还不了解,请看:Android Fragment 真正的完全解析(上). 本篇将介绍上篇博客提到的:如何管理Frag ...
- Android Fragment使用(二) 嵌套Fragments (Nested Fragments) 的使用及常见错误
嵌套Fragment的使用及常见错误 嵌套Fragments (Nested Fragments), 是在Fragment内部又添加Fragment. 使用时, 主要要依靠宿主Fragment的 ge ...
- Android Fragment使用(一) 基础篇 温故知新
Fragment使用的基本知识点总结, 包括Fragment的添加, 参数传递和通信, 生命周期和各种操作. Fragment使用基础 Fragment添加 方法一: 布局里的标签 标识符: tag, ...
- Android Fragment 真正的完全解析(下)
转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/37992017 上篇博客中已经介绍了Fragment产生原因,以及一些基本的用法和 ...
- Android Fragment 解析和使用
Android Fragment的生命周期和Activity类似,实际可能会涉及到数据传递,onSaveInstanceState的状态保存,FragmentManager的管理和Transactio ...
- android fragment 博客 学习记录
转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/37992017 上篇博客中已经介绍了Fragment产生原因,以及一些基本的用法和 ...
- Android Fragment详解
一.什么是Fragment Android在3.0中引入了fragments的概念,主要目的是用在大屏幕设备上--例如平板电脑上,支持更加动态和灵活的UI设计.平板电脑的屏幕要比手机的大得多,有更多的 ...
随机推荐
- JS模块与命名空间的介绍
起因将代码组织到类中的一个重要原因是让代码更加“模块化”,可以在很多不同的场景中实现代码的重用.但类不是唯一的模块化代码的方式. 一般来讲,模块是一个独立的JS文件.模块文件可以包含一个类定义.一组相 ...
- 从久负盛名的GoDaddy开发革命来看Node.js的风靡程度
英文原文连接:http://venturebeat.com/2015/02/09/godaddy-nodejitsu/ 网站主机托管公司GoDaddy将要进一步通过新的开发工具来提升自身能力.最新消息 ...
- PHP 11:函数
原文:PHP 11:函数 本文章介绍PHP的函数.如何学习呢?可以从以下几个方面考虑 函数是如何定义的?区分大小写吗? 函数的参数是如何定义的? 函数是否支持重载? 函数的返回值是如何定义的. 函数有 ...
- UC编程:输入输出重定向(系统调用)
在Unix下,系统重定向是使用dup和dup2函数完成的 在学习使用这两个函数之前,必须要搞懂一个概念就是文件描述符 摘自:<文件描述符和文件指针的区别> 文件描述符就是open文件时产生 ...
- Ping域名惊现65.49.2.178
--- 昨天新建的博,早晨起来进去看看,发现无法访问.这… 排错开始,ping域名出现如上图所示结果,请求超时…哪里的问题呢 有时常识是害人的,想起了前两月群里也有人说本地无法访问自己网站,别人能访问 ...
- 笔试题&面试题:CW输出矩阵
称号:CW输出矩阵(N*N). 如果一个矩阵: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 那么程序应该给出的输出为:1 2 3 4 8 1 ...
- Sql Server中如何快速修正SQL 语句错误
本文将和大家讨论一些关于找SQL 错误的问题. 现在的系统基本都是需要用到数据库的,既然用到数据库我们就要写SQL 脚本,常用的做法是现在Microsoft Sql Server Management ...
- IE低版本下实现html5的placeholder(表单提示)功能
placeholder 属性提供可描述输入字段预期值的提示信息(hint). 该提示会在输入字段为空时显示,并会在字段获得焦点时消失. 注释:placeholder 属性适用于以下的 <inpu ...
- Extjs中GridPanel的各个属性与方法
1.Ext.grid.GridPanel 主要配置项: store:表格的数据集 columns:表格列模式的配置数组,可自动创建ColumnModel列模式 autoExpandColumn:自动充 ...
- c#事件求解
闲来无聊对于clr一书又重新温习了下,但是看到事件这张后还是有很多的困惑,对于事件能力CLR是这样描述,通知其它对象发生特定的事情. 1.其它对象:是指对于事件的关注者 2.特定的事件:对于满足事件交 ...