0
我使用如何将%02d:%02d:%02d转换为double?
Min_txtvw.setText(String.format(mTimeFormat, hour, min, sec));
现在 average=distance*60*60/seconds
//我的函数为秒发现平均 我不得不从Min_txtvw 我做它像之下,但它给NumberformatException
得到的时间,
TextView
try {
String s = Min_txtvw.getText().toString();
double d = Double.valueOf(s.trim()).doubleValue();
System.out.println("average distance is"+d);
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
我如何转换TextView
值并将其转换为双精度值?
此行'一个String = Min_txtvw.getText()的toString()之后;''放的System.out.println(S);',并告诉我它显示 – Lucifer 2013-04-25 06:28:29
04-25 12:02:25.841:I/System.out(12690):s的值是00:01:18 04-25 12:02:25.841:I/System.out(12690):formatted value of s是00:01:18 – Raj 2013-04-25 06:35:45
@Raj,我已经更新了答案,请再试一次。 – Lucifer 2013-04-25 06:37:46