1

カードゲームのスコアを維持するための基本的にタブ付きアクティビティであるアクティビティがあります。

問題は、電話がかかってきてアプリに戻ると、スコアがクリアされていることです。

という電話がかかってきて、活動が再開されたようです。なぜこれが起こっているのですか、どうすれば修正できますか?

ありがとうございました

4

1 に答える 1

2

Android devices had limited memory, and can only run so many apps at once. Phone calls are one of the most taxing tasks on a mobile's hardware, as audio streams aren't exactly small on memory usage.

Due to this, I think your app's current instance is killed to free up RAM, and this results in a loss of scores for you.

To fix this, you could write the value of the scores to SharedPreferences in your Activity's onPause() and then retrieve them in onResume().

于 2012-12-09T21:31:33.577 に答える