我收到错误: - INSTRUMENTATION_STATUS:stack = android.util.TimeFormatException:字符串太短 - 预计至少8个字符。
public void test() {
TextView onDeviceTime = (TextView) mNextUIMainActivity.findViewById(R.id.timeOfDay);
Time onSystem = new Time();
onSystem.setToNow();
Time onLauncherDisplay = new Time();
onSystem.parse(onDeviceTime.getText().toString());
if (onDeviceTime.equals(onSystem)) {
System.out.println("Correct time!");
}
}
答案 0 :(得分:-1)
您尝试比较Time
对象和TextView
对象。听起来你真正想要的是if (onLauncherDisplay.equals(onSystem))
。