项目随笔(四)

1.Caused by: android.system.ErrnoException: sendto failed: EPIPE (Broken pipe)
12-26 14:18:04.501 17583-18232/com.yskj.hzfinance W/System.err: at libcore.io.Posix.sendtoBytes(Native Method)
12-26 14:18:04.501 17583-18232/com.yskj.hzfinance W/System.err: at libcore.io.Posix.sendto(Posix.java:211)
12-26 14:18:04.501 17583-18232/com.yskj.hzfinance W/System.err: at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:278)
12-26 14:18:04.501 17583-18232/com.yskj.hzfinance W/System.err: at libcore.io.IoBridge.sendto(IoBridge.java:509)
That error occurs when the client try to write to a connection when the backend has already closed it.

That error occurs when the client try to write to a connection when the backend has already closed it. By default Android set the Keep Alive property to true and will reuse the old socket connections since establishing a connection is a resource consuming operation in a mobile environment (you can test it with a tool like  fiddler ). Try to set the Connection header to close or call System.setProperty("http.keepAlive", "false"); in order to disable Keep Alive and thus forcing the system to create a new connection.

2.setKeepAlive()

setKeepAlive(boolean on);

当设置为true的时候,TCP会实现监控连接是否有效,当连接处于空闲状态的时候,超过了2个小时,本地的TCP实现会发送一个数据包给远程的socket,如果远程没有发回响应,TCP会持续尝试11分钟,知道响应为止,如果在12分钟的时候还没响应,TCP尝试关闭socket连接。
3.同名自定义权限
<!--<permission-->
<!--android:name="getui.permission.GetuiService.com.dx168.efsmobile"-->
<!--android:protectionLevel="normal"-->
<!--tools:ignore="UniquePermission" />-->
4. 为什么你的自定义View wrap_content不起作用?
5.tabLayout样式
if(adapter.getCount() <6){
    tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
    tabLayout.setTabMode(TabLayout.MODE_FIXED);
}else {
    tabLayout.setTabGravity(TabLayout.GRAVITY_CENTER);
    tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);

}
tabLayout.setupWithViewPager(viewPager);
6.tab,fragment,viewpager复杂嵌套时的显示隐藏控制
     当Fragment 从隐藏切换至显示的时候,不会调用onResume(),Fragment 的onResume()是Fragment 和它的宿主在切换时才会调用的,而Fragment 之间切换时,不会调用onResume()方法,仔细查看发现Fragment 之间切换,Fragment 从隐藏切换至显示,会调用onHiddenChanged(boolean hidden)方法
[java] view plain copy
  1. public void onHiddenChanged(boolean hidden) {  
  2. // TODO Auto-generated method stub  
  3. super.onHiddenChanged(hidden);  
  4. if (hidden) {// 不在最前端界面显示  
  5.   
  6. else {// 重新显示到最前端中  
  7.   
  8. }  
  9. }  




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值