解決策を見つけました。
save 関数では、次のメソッドを使用して値を保存します。
private long calculateElapsedTime(Chronometer mChronometer) {
long stoppedMilliseconds = 0;
String chronoText = mChronometer.getText().toString();
String array[] = chronoText.split(":");
if (array.length == 2) {
stoppedMilliseconds = Integer.parseInt(array[0]) * 60 * 1000
+ Integer.parseInt(array[1]) * 1000;
} else if (array.length == 3) {
stoppedMilliseconds = Integer.parseInt(array[0]) * 60 * 60 * 1000
+ Integer.parseInt(array[1]) * 60 * 1000
+ Integer.parseInt(array[2]) * 1000;
}
return stoppedMilliseconds;
}
ロード機能では、クロノメーターを次のように更新します。
((GameActivity) activity).getcGameTime().setBase(
SystemClock.elapsedRealtime() - gameElapsedTime(getcGameTime()));
これがいつか誰かを助けることを願っています。乾杯!