Bug: Touch Action Up recycled twice

cmweb

Active Member
Licensed User
Longtime User
Thank you. It will be fixed in the next update. For now you can use CallSubDelayed inside ListView_ItemClick to call a sub with the current code and it should fix this issue.

That's great. Thank you very much.

Best regards,

Carsten

Gesendet von meinem GT-N7000 mit Tapatalk 2
 

cheese

Member
Licensed User
Longtime User
Is there a plan for when the update may come out which addresses this bug? Is it possible to get access to a beta in advance? I am reluctant to make changes to my current code base using the callsubdelayed work around.

Cheers
 

Kevin

Well-Known Member
Licensed User
Longtime User
I saw a crash report with this error for my app today. I'm at work and busy so I can't look into it right now to see where it happened, but if need be I can do that sometime tomorrow.

java.lang.RuntimeException: MotionEvent { action=ACTION_UP, id[0]=0, x[0]=276.51968, y[0]=121.82678, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=13413390, downTime=13413204, deviceId=2, source=0x1002 } recycled twice!
at android.view.MotionEvent.recycle(MotionEvent.java:1659)
at android.view.ViewRootImpl.finishMotionEvent(ViewRootImpl.java:3031)
at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3022)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2582)
at android.view.ViewRootImpl.processInputEvents(ViewRootImpl.java:887)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:901)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2558)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4697)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
at dalvik.system.NativeStart.main(Native Method)
 

cmweb

Active Member
Licensed User
Longtime User
Hi Erel,

Thank you. It will be fixed in the next update. For now you can use CallSubDelayed inside ListView_ItemClick to call a sub with the current code and it should fix this issue.
Unfortunately, it doesn't work for me with CallSubDelayed.

This is my code:

B4X:
Sub ListView1_ItemClick (Position As Int, Value As Object)
   listpos = Position
   CallSubDelayed(Me,listviewklick)
end sub

Sub listviewklick
   ergebnis = InputList(actionlist,"Select:",0)
   If ergebnis = 0 Then 
      identselect = listpos
      StartActivity("edit")
   End If
   If ergebnis = 1 Then
      If freeversion = False Then
         identselect = ListView1.Size
         newitem = True
         StartActivity("edit")
      Else
         If ListView1.Size < 4 Then
            identselect = ListView1.Size
            newitem = True
            StartActivity("edit")
         Else
            Marketlink
         End If
      End If
   End If
   If ergebnis = 2 Then
      identselect = listpos
      sql1.Initialize(File.DirInternal,"filemover.db",True)
      sql2.Initialize(File.DirInternal,"interims.db",True)
      sql2.ExecNonQuery("DROP TABLE IF EXISTS table1")
      sql2.ExecNonQuery("CREATE TABLE table1 (nr INTEGER, identifier TEXT, source TEXT, target TEXT, copmov TEXT)")
'      sql1.ExecNonQuery("DELETE FROM table1 WHERE nr = '" & identselect & "'")
      Dim cursor1 As Cursor
      cursor1 = sql1.ExecQuery("SELECT nr, identifier, source, target, copmov FROM table1")
      
      If cursor1.RowCount > 0 Then
         For i = 0 To cursor1.rowCount -1
         cursor1.Position = i
         cpident = cursor1.getstring("identifier")
         cpsource = cursor1.GetString("source")
         cptarget = cursor1.GetString("target")
         cpnr = cursor1.GetInt("nr")
         cpcopmov = cursor1.GetString("copmov")
         If cursor1.Position <> identselect Then sql2.ExecNonQuery("INSERT INTO table1 VALUES(" & cpnr & ",'" & cpident & "','" & cpsource & "','" & cptarget & "','" & cpcopmov & "')")
         Next
      End If
      File.Delete(File.DirInternal,"filemover.db")
      File.Copy(File.DirInternal,"interims.db",File.DirInternal,"filemover.db")
      cursor1.Close
      sql1.close
      sql2.close
      auslesen
   End If
End Sub

The Input list shows up when I click on a listview item.

But when I return to the activity, I'm getting this error:

B4X:
java.lang.Exception: Sub  was not found.
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:176)
   at anywheresoftware.b4a.keywords.Common$4$1.run(Common.java:869)
   at anywheresoftware.b4a.BA.setActivityPaused(BA.java:366)
   at filemover.tst.main$ResumeMessage.run(main.java:190)
   at android.os.Handler.handleCallback(Handler.java:587)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:123)
   at android.app.ActivityThread.main(ActivityThread.java:4627)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:521)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
   at dalvik.system.NativeStart.main(Native Method)
java.lang.Exception: Sub  was not found.

Am I doing something wrong?

Best regards,

Carsten
 
Top