0

我在 Android 应用程序中遇到数组越界错误,我不知道如何解决这个问题。似乎所有相关检查都已完成。

我的代码如下:

private final Handler handler = new Handler() {
    @Override
    public void handleMessage(android.os.Message msg) {
        if (msg.what == GLES20VideoRenderer.MESSAGE_TIMING) {
            Bundle data = msg.getData();

            if ((data != null) && !data.isEmpty()) {
                    if (data.containsKey("utc_timestamp_ms")) {
                        updateTimeDisplay(data.getLong("utc_timestamp_ms"));
                    }

                    if (data.containsKey("streaming")) {
                        if (overlayBusy != null) {
                            if (overlayBusy.getVisibility() != View.INVISIBLE) {
                                overlayBusy.setVisibility(View.INVISIBLE);
                            }
                        }
                    }
            }
        }
    }
};

我收到以下错误:

10-30 07:53:07.923: E/AndroidRuntime(19371): java.lang.ArrayIndexOutOfBoundsException: length=0;    index=0
10-30 07:53:07.923: E/AndroidRuntime(19371):    at android.util.ArrayMap.indexOf(ArrayMap.java:113)
10-30 07:53:07.923: E/AndroidRuntime(19371):    at android.util.ArrayMap.get(ArrayMap.java:366)
10-30 07:53:07.923: E/AndroidRuntime(19371):    at android.os.Bundle.getLong(Bundle.java:1029)
10-30 07:53:07.923: E/AndroidRuntime(19371):    at android.os.Bundle.getLong(Bundle.java:1016)

任何帮助将不胜感激。

4

1 回答 1

1

https://code.google.com/p/android/issues/detail?id=76888

这可能是由 OS<5.1 设备中的潜在竞争条件引起的。

于 2016-07-08T04:41:09.683 回答