Android
来源:互联网 发布:.vip域名备案 编辑:程序博客网 时间:2024/04/27 17:45
1 打印线程id
Thread.currentThread().getId()
2 打印堆栈
Log.info(Log.getStackTraceString(new Throwable()));
3.天气访问接口
接口地址:http://www.weather.com.cn/data/sk/101010100.htmlhttp://www.weather.com.cn/data/cityinfo/101010100.htmlhttp://m.weather.com.cn/data/101010100.html
4豆瓣250连接
https://api.douban.com/v2/movie/top250?start=0&count=10
5 判断当前是否允许横竖屏切换
private boolean isAutoRotateOn(Context context) { return android.provider.Settings.System.getInt(context.getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0) == 1 ; }
6 Fragment&ViewPager
I encountered the similar issue as you, after several hours research, I found the issue. If your ViewPager is created inside the Fragment, you need to use getChildFragmentManager() for the FragmentPagerAdapter, rather than getFragmentManager().
So your setupViewPager() method should look like this.
private void setupViewPager(ViewPager viewPager) { ViewPagerAdapter adapter = new ViewPagerAdapter(getChildFragmentManager()); adapter.addFrag(new Courses(), "IT"); adapter.addFrag(new CoursesBussiness(), "Business"); viewPager.setAdapter(adapter);}
The root cause of the issue is you embeded Fragments inside the Fragment, that’s why it will throw the exception.
java.lang.IllegalStateException: FragmentManager is already executing transactions
According to the Google’s docs:
You can now embed fragments inside fragments. This is useful for a variety of situations in which you want to place dynamic and re-usable UI components into a UI component that is itself dynamic and re-usable. For example, if you use ViewPager to create fragments that swipe left and right and consume a majority of the screen space, you can now insert fragments into each fragment page. To nest a fragment, simply call getChildFragmentManager() on the Fragment in which you want to add a fragment. This returns a FragmentManager that you can use like you normally do from the top-level activity to create fragment transactions.
- Android
- android
- Android
- android
- android
- Android
- Android
- android
- android
- android
- Android
- Android
- android!!!
- android
- android
- android
- android
- android:
- HDU 1253 胜利大逃亡(DFS)
- 在继续编译bfs时遇到git - fatal: bad revision 'HEAD'以及error: invalid suffix on literal; C++11 requires a spac
- IOS UIApplication 和 delegate 以及程序启动原理
- 关于如何编写与调用java的JNI程序
- 一个查询(报表)优化案例
- Android
- Android开发---关于回调函数的理解
- Java接口的基本概念详解
- cuda编程入门示例14
- linux 系统应该删除哪些文件
- 多线程的相关关键词理解 volatile,atomic,synchronized,lock
- Java Web中Tomcat 目录学习以及配置
- 面试也是技术成长的一部分
- MySQL在windows下的安装与配置使用