I use Erel's [B4X] CLVSwipe and especially pull to refresh. If you try lib's example and don't add any item at listview and try left or right gesture at blank CLV, reproduces this error.
211 line at clvSwipe is this:
B4X:
Error occurred on line: 211 (CLVSwipe)
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[])' on a null object reference
at anywheresoftware.b4a.shell.Shell.runGoodChain(Shell.java:479)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:293)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:176)
at anywheresoftware.b4a.objects.TouchPanelCreator$TouchView.onInterceptTouchEvent(TouchPanelCreator.java:32)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2402)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:559)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1870)
at android.app.Activity.dispatchTouchEvent(Activity.java:3236)
at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:521)
at android.view.View.dispatchPointerEvent(View.java:10946)
211 line at clvSwipe is this:
B4X:
Private Sub TouchPanel_OnInterceptTouchEvent (Action As Int, X As Float, Y As Float, MotionEvent As Object) As Boolean
If HandlingSwipe Or WaitingForRefreshToComplete Then Return True
Select Action
Case Base.TOUCH_ACTION_DOWN
TouchXStart = X
TouchYStart = Y
HandlingSwipe = False
Case Base.TOUCH_ACTION_MOVE
Dim dx As Float = Abs(x - TouchXStart)
Dim dy As Float = Abs(y - TouchYStart)
If mPullToRefreshPanel.IsInitialized And mCLV.sv.ScrollViewOffsetY = 0 And y - TouchYStart > 3dip Then
HandlingSwipe = True
PullToRefreshSwipe = True
mPullToRefreshPanel.Visible = True
CloseLastSwiped
Else If dy < 20dip And dx > 10dip Then
If HandlingSwipe = False Then
Dim NewSwipeItem As Int = mCLV.FindIndexFromOffset(TouchYStart + mCLV.sv.ScrollViewOffsetY) <-----------
If NewSwipeItem <> LastSwipedItem Then CloseLastSwiped
LastSwipedItem = NewSwipeItem
End If
HandlingSwipe = True
PullToRefreshSwipe = False
End If
End Select
Return HandlingSwipe
End Sub
Last edited: