Bug? B4A 5.5 Beta #2: IllegalStateException

corwin42

Expert
Licensed User
Longtime User
I get the following exception with B4A 5.5 Beta #2 in one of my apps.

I haven't found the exact place where this exceptions happens. Maybe it is when I jump to a position in a custom listview.

10:51:42.840 - Cache Hit for 103_141_141
10:51:42.843 - Cache Hit for 103_141_141
java.lang.IllegalStateException: This method must only be called as part of a callback while a frame is in progress.
at android.view.Choreographer.getFrameTimeNanos(Choreographer.java:511)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2591)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2434)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2067)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6013)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:606)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
 

corwin42

Expert
Licensed User
Longtime User
Yes, it crashed and I can reproduce it.

I will have to do some more checks, hopefully tomorrow. Fact is that it worked with 5.20 and crashes with 5.5 beta.
It crashes when I fill a CustomListview and jump to a specific line. If I don't jump to that line everything seems to be fine. Has something to do with the jump to the position in the Scrollview.
 

corwin42

Expert
Licensed User
Longtime User
Hmm, currently I'm unable to reproduce it in a simple project. It still happens in my app.

I fill two CustomListViews with entries. Both of them on a AHViewPager Page.
When the first LisView is filled, I jump to a specific entry of the CustomListView with JumpToItem.

The app crashes when all refreshes to the screen are done (seems so because the complete code has run).

If I remove the two DoEvents from JumpToItem the exception does not occur. If I fill both CustomListViews without jumping to the position in the first List everything is fine, too. After both listviews are initialized I can refresh the list entries and jump to an item, too.

I currently have no idea how to reproduce it. Fact is that in 5.20 all worked well. In 5.5 Beta I get the crash. Tried it on a Nexus 5 with Android 6 and a Nexus 7 with 5.1.1.
 

corwin42

Expert
Licensed User
Longtime User
Interesting. I don't get the exception now but at first time (when the CustomListView is filled first) it do not jump to the specified item. Only at the second call.

But I now know how to solve it.

Thanks very much.
 
Top