Android 获取一个随机的四位数字验证码


    private void randomCode() {
        String strRand = "";
        for (int i = 0; i < 4; i++) {
            strRand += String.valueOf((int) (Math.random() * 10));
        }
        textrandomcode.setText(strRand);
        Log.i("aaa", "randomCode: " + strRand);
    }

猜你喜欢

转载自blog.csdn.net/h1047445540/article/details/86511654