Сегодня я отлаживал приложение для Android, и он сработал. Вот стек вызовов:Почему этот стек вызовов настолько странный?
android.content.res.Resources$NotFoundException: String resource ID #0x8822
at android.content.res.Resources.getText(Resources.java:246)
at android.widget.TextView.setText(TextView.java:3860)
at com.whackanandroid.GameActivity.gameOver(GameActivity.java:68)
at com.whackanandroid.Game$1.onCountDownFinished(Game.java:79)
at com.whackanandroid.CountDown$1.run(CountDown.java:23)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:5225)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
Тогда я нажал на номер линии связи (TextView.java:3860) и он взял меня к линии JavaDoc комментария. Я был очень смущен. Комментарии never получить выполненный. Это не может быть ошибкой. Это странно.
Вот мой код:
public void gameOver() {
tvScore.setText (Integer.toString (Game.getInstance().getScore()));
tvHighscore.setText (Game.getInstance().getHighscore());
tvScoreText.setVisibility (View.VISIBLE);
tvScore.setVisibility (View.VISIBLE);
Animation anim = AnimationUtils.loadAnimation (this, R.anim.cover_fade_in);
anim.setAnimationListener (new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
GameActivity.this.cover.setVisibility (View.VISIBLE);
}
@Override
public void onAnimationEnd(Animation animation) {
GameActivity.this.cover.setVisibility (View.VISIBLE);
Game.InitializeGame (GameActivity.this);
cover.setVisibility (View.VISIBLE);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
cover.startAnimation (anim);
}
Линия tvHighscore.setText (Game.getInstance().getHighscore());
относится к строке в стеке вызовов: at com.whackanandroid.GameActivity.gameOver(GameActivity.java:68)
. Я думаю, это может быть потому, что родительский взгляд tvHighscore, LinearLayout
- GONE
. Это имеет значение? Или я сделал что-то еще неправильно?
Если вам нужно увидеть больше кода, не стесняйтесь спрашивать меня.
Различные версии источника тока и источника, когда он был составлен - нормально. –
Android пытается найти ресурс со значением int tvHighscore.setText (Game.getInstance() .getHighscore()); –