Problem with Class DraggableView

D

Deleted member 103

Guest
Hi,

I get this error when I use the classe "DraggableView".
Error message:
HTML:
java.lang.RuntimeException: MotionEvent { action=ACTION_UP, id[0]=0, x[0]=259.0, y[0]=614.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=119891904, downTime=119891808, deviceId=7, source=0x1002 } recycled twice!

    at android.view.MotionEvent.recycle(MotionEvent.java:1746)
    at android.view.ViewRootImpl.finishMotionEvent(ViewRootImpl.java:3150)
    at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3141)
    at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2690)
    at android.view.ViewRootImpl.processInputEvents(ViewRootImpl.java:930)
    at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2704)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:4977)
    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:784)

    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
    at dalvik.system.NativeStart.main(Native Method)

With Project "testdrag_with_extra-button.zip" comes this error message and
Project on "testdrag_without_extra-button.zip" is no error message.
Can someone explain to me why?

Ciao,
Filippo
 

Attachments

  • testdrag_with_extra-button.zip
    7.7 KB · Views: 224
  • testdrag_without_extra-button.zip
    7.6 KB · Views: 220
D

Deleted member 103

Guest
Thank you Erel,

I have it solved. Did you perhaps a better solution?
B4X:
'Activity module
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.

   Type TouchArg(btn As Button, x As Float,y As Float,ACTION As Int)
End Sub

Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.
   Dim Button1 As Button
    Dim Button2 As Button
   Dim dv(2) As DraggableView   

   Dim btn As Button
   Dim PosX,PosY As Int            'Position der ausgeählte Karte

   Dim timMsgbox As Timer
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("1")
  
    dv(0).Initialize(Activity, Button1,"Main")
    dv(1).Initialize(Activity, Button2,"Main")

   'Timer for Msgbox
   timMsgbox.Initialize("timMsgbox",100)
   timMsgbox.Enabled=False

End Sub

Sub Activity_Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
End Sub

Sub Activity_Touch (Action As Int, X As Float, Y As Float)

   Activity.Title = dv(1).left
       
End Sub

Sub pnlKarteTouch(TouchArg1 As TouchArg) As Boolean
   Select TouchArg1.ACTION
    Case Activity.ACTION_DOWN
      btn=TouchArg1.btn
        PosY=btn.top
        PosX=btn.left
    Case Activity.ACTION_MOVE
      btn.BringToFront
    Case Activity.ACTION_UP
      goKarteAblage(TouchArg1.X,TouchArg1.Y)
   End Select
   Return True
End Sub

Sub goKarteAblage(mPosX As Float, mPosY As Float)
Log("mPosY=" & mPosY)
   If mPosY> 70 Then
      timMsgbox.Enabled=True
   End If
End Sub

Sub timMsgbox_Tick
   timMsgbox.Enabled=False
   Msgbox2("Test1","Test1","OK","","",Null)
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…