String 字符串替换不能与if语句一起使用
1.我在代码中遇到字符串不替换的问题 2.我试着练习做一个时钟,试着让秒显示为“00”String 字符串替换不能与if语句一起使用,string,integer,String,Integer,1.我在代码中遇到字符串不替换的问题 2.我试着练习做一个时钟,试着让秒显示为“00” 使用字符串格式将字符串格式化为所需格式。比如String.format(“%d”,101)或String.format(“我的答案是%15.8f”,47.65734)谢谢。但它在这方面不起作用。这个代码似乎是正确的。但它没有输出正确的结果——进步代表什么价值?是小时吗? SeekBar timerSeekBar = (SeekBar) findViewById(R.id.timerSeekBar
使用字符串格式将字符串格式化为所需格式。比如String.format(“%d”,101)或String.format(“我的答案是%15.8f”,47.65734)谢谢。但它在这方面不起作用。这个代码似乎是正确的。但它没有输出正确的结果——进步代表什么价值?是小时吗?
SeekBar timerSeekBar = (SeekBar) findViewById(R.id.timerSeekBar);
TextView timerTextView = (TextView) findViewById(R.id.timerTextView);
timerSeekBar.setMax(600);
timerSeekBar.setProgress(30);
int minutes = (int) progress/60;
int seconds = progress-minutes * 60;
String secondString = Integer.toString(seconds);
//he is the problem it not pass right string .
if (secondString =="0"){
secondString = "00";
}
timerTextView.setText(Integer.toString(minutes)+ ":"+secondString);
Log.i("check String", secondString);
}```