Dim GD0 As GestureDetector
Dim GD1 As GestureDetector
Dim GD2 As GestureDetector
Dim GD3 As GestureDetector
Dim GD(4) As GestureDetector
...
GD=Array As GestureDetector(GD0, GD1, GD2, GD3)
piece=Array As Panel(pcs0, pcs1, pcs2, pcs3)
Dim i As Int
For i= 0 To 3
GD(i).SetOnGestureListener(piece(i), "Gesture")
Next
....
Sub Gesture_onDrag(deltaX As Float, deltaY As Float, MotionEvent As Object)
Dim i As Panel=Sender
Dim j As Int
j=i.Tag
Log("no " & " " & j)
'piece(j).Elevation=5dip 'no crash , but also no reaction
'piece(i).bringtofront crashes as well as piece(j).bringtofront
i.left = Max(9dip, Min(i.Left + deltaX, bg.width -i.Width-9dip))
i.top = Max(9dip, Min(i.Top + deltaY, bg.height-i.height))
If DipToPixels(i.top) < 340 Then
i.SetLayoutAnimated(0,i.left, i.top, states.Get("width" & j), states.Get("height" & j))
Else
i.SetLayoutAnimated(0,i.left, i.top, states.Get("width" & j)*0.6, states.Get("height" & j)*0.6)
End If
End Sub