不要问我为什么,只能这么干

Iterator<UserInfo> item = UserManage.getInstance().getRegistUserInfos().iterator();
        while(item.hasNext()){  
            UserInfo userInfo = item.next();  
            if(userInfo.getUserId().equals(userId)){
                item.remove();
                break;
            }  
        }  
// Switch 控件之坑
swt.setChecked(true);//则onCheckedChanged回调会被执行
swt.setChecked(false);//则onCheckedChanged回调不会被执行

3.去掉一个String中的中文

private String delChinese(String chineseStr){
        String reg = "[\u4e00-\u9fa5]";
        Pattern pat = Pattern.compile(reg);
        Matcher mat=pat.matcher(chineseStr);
        return mat.replaceAll("");
    }

4.与服务器时间保持同步

df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    // 服务器时间
    serverTime = new Date(); // 这里取本地时间,为了测试
    // 开机之后会保持一个时钟(绝对时间)
    C1 = SystemClock.elapsedRealtime();
    
    showText = (TextView)findViewById(R.id.showText);
    
    Button button = (Button)findViewById(R.id.testButton);
    button.setText("当前时间:"+df.format(serverTime));
    button.setOnClickListener(new OnClickListener() {
       @Override
       public void onClick(View v) {
        C2 = SystemClock.elapsedRealtime();
        // 当前时间=服务器时间+时间差
        Date curDate = new Date(serverTime.getTime()+(C2-C1));

        String s = df.format(curDate);
        showText.setText("最新当前时间:"+s);
       }
      });

5.
QQ图片20180606165149.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,256评论 19 139
  • 国家电网公司企业标准(Q/GDW)- 面向对象的用电信息数据交换协议 - 报批稿:20170802 前言: 排版 ...
    庭说阅读 11,297评论 6 13
  • 1. Java基础部分 基础部分的顺序:基本语法,类相关的语法,内部类的语法,继承相关的语法,异常的语法,线程的语...
    子非鱼_t_阅读 31,839评论 18 399
  • 我知道,你是奔着价值100万用户的干货经验来的,可是怎么会看了一篇干货,就能如法炮制来获取用户呢? 不如,2016...
    APP干货铺子阅读 358评论 0 8
  • 前天的饭桌上,有位女士三次在饭桌上大声当着大家的面说:鹿晗和关小彤在一起了。一位仁兄反问她:在一起又怎么样了?她的...
    成不熟阅读 277评论 0 0