美文网首页
安卓验证码重新发送

安卓验证码重新发送

作者: yasuion | 来源:发表于2019-09-29 13:00 被阅读0次

import android.annotation.SuppressLint;

import android.graphics.Color;

import android.os.CountDownTimer;

import android.widget.Button;

// 验证码发送间隔60秒

public class TimeCountextends CountDownTimer {

int color = Color.parseColor("#ffffff");

private Buttonbutton;

/**

    * @param millisInFuture  总时间

    *

*

    * @param countDownInterval 间隔多少秒

    *@param button 传入button控件

*/

    public TimeCount(long millisInFuture,long countDownInterval, Button button) {

super(millisInFuture, countDownInterval);

this.button=button;

}

@SuppressLint("SetTextI18n")

@Override

    public void onTick(long millisUntilFinished) {

button.setTextColor(color);

button.setClickable(false);

button.setText("("+millisUntilFinished /1000 +") 秒后重发");

}

@Override

    public void onFinish() {

button.setText("重新获取");

button.setClickable(true);

button.setTextColor(color);

}

}

// 使用

private TimeCounttimeCount;

timeCount =new TimeCount(60000,1000,button);

// button点击事件里面

timeCount.start();

// 效果

相关文章

  • 安卓验证码重新发送

    import android.annotation.SuppressLint; import android.gr...

  • 邀请好友 测试问题

    1.【邀请好友】【发送验证码】安卓阿语验证码框显示异常用display: inline-block;在阿语下不会垂...

  • 谷歌

    谁知道安卓怎么注册谷歌账号 关键是手机号的问题,发送不了一验证码。

  • 关于安卓自定义验证码输入框的实现

    题目:关于安卓自定义验证码输入框的实现 在安卓登录界面,常常需要用到验证码登录,这个时候,自定义验证码输入框就能派...

  • 印象笔记安卓系统同步失败怎么办?

    退出安卓系统印象笔记账号,重新登录! 退出安卓系统印象笔记账号,重新登录!! 退出安卓系统印象笔记账号,重新登录!!!

  • Android 自定义倒计时控件

    需求描述 倒计时功能是安卓app中常见的功能之一。比如发送验证码啊,距离比赛或者直播或者抢购还有xx时间啊等等。。...

  • jQuery和JS中的获取验证码

    点击按钮获取验证码 需求:禁止用户连续点击,发送失败可继续发送,时间到了可重新发送 说明:setInterval(...

  • 安卓邮件发送

    我们今天来做一个安卓的邮件发送 1.准备必要的jar包 JavaMail 下载地址: https://github...

  • SO逆向之x博国际版登陆分析

    篇幅有限 完整内容及源码关注公众号:ReverseCode,发送 冲 抓包 Charles本地证书 安卓8 安卓...

  • 安卓最简单的短信验证码发送

    布局没啥好说的,直接丢一个TextView OK,搞定了,就怎么简单粗暴 最后来个效果图,很low,能看就行(能偷...

网友评论

      本文标题:安卓验证码重新发送

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