I am getting an array out of bounds error in an Android application, and I cannot figure out how to resolve this problem. It seems as if all the relevant checks are done.
My code is as follows:
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);
}
}
}
}
}
}
};
I get the following error:
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)
Any help will be appreciated.