如果可能的话,我想将milsec作为CountDownTimer的持续时间,这样做的方法是什么?
MuteBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
float seconds = Float.parseFloat(inputSeconds.getText().toString());
float milsec = seconds * 1000;
new CountDownTimer(milsec, 1000) {
public void onTick(long millisUntilFinished) {
inputSeconds.setText("seconds remaining: " +
millisUntilFinished / 1000);
inputMinutes.setText("Minutes remaining:" +
millisUntilFinished / 6000);
}
public void onFinish() {
inputSeconds.setText("Unmuted");strong text
}
}.start();
}
});
答案 0 :(得分:0)
我使用
将浮动转换为longlong milsec = (long) (seconds * 1000);
现在可行了