美文网首页
Android常用功能

Android常用功能

作者: 程序员文艺范 | 来源:发表于2017-01-09 16:33 被阅读0次
    // 将文本内容放到系统剪贴板里。
    ClipboardManager cm = (ClipboardManager)getActivityContext().getSystemService(Context.CLIPBOARD_SERVICE);
    cm.setText(joinGroupDetailBean.getEntryNumber());ToastUtil.showCenterToast("复制成功");
    
    // 打电话
    Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + joinGroupDetailBean.getSponsorPhone()));
    startActivity(intent);
    
    //时间倒数器
    final Handler handler=new Handler();
    final Timer timer =new Timer();
    timer.schedule(new TimerTask() {    
      @Override    
      public void run() {       
        handler.postDelayed(new Runnable() {            
            @Override            
            public void run() {                
              long time=(data.getEntryEndTime()-System.currentTimeMillis())/1000;                
                  if (time<=0) {                    
                    timer.cancel();               
                 }                
                 long day=time/86400;                
                 long hour=(time-day*86400)/3600;               
                 long minute=(time-day*86400-hour*3600)/60;               
                 long second=time-day*86400-hour*3600-minute*60;                
                 remainDayTv.setText(""+day+"");                
                 remainHourTv.setText(""+hour+"");                
                 remainMinTv.setText(""+minute+"");                
                 remainSecondTv.setText(""+second+"");           
           }        
        },0);    
    }},0,1000);
    

    相关文章

      网友评论

          本文标题:Android常用功能

          本文链接:https://www.haomeiwen.com/subject/nnbwmttx.html