Greetings,
Can you check my coding? I'm trying to set up an on touch listener on one of my image views with the reflection library. I can compile the app without errors but when I run the app the logs indicate this error:
I think it's because I'm missing some additional code. Can you tell me what additional coding I need to add or correct? Which object is null and how to I change the coding so it's not null?
Thanks.
Can you check my coding? I'm trying to set up an on touch listener on one of my image views with the reflection library. I can compile the app without errors but when I run the app the logs indicate this error:
B4X:
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setOnTouchListener(android.view.View$OnTouchListener)' on a null object reference
I think it's because I'm missing some additional code. Can you tell me what additional coding I need to add or correct? Which object is null and how to I change the coding so it's not null?
Thanks.
B4X:
Sub InitializeObjects
theReflector.SetOnTouchListener("MapTouch")
theReflector.Target = MoldMapView
strShared = Starter.rp.GetSafeDirDefaultExternal("Settings")
' This is for the KeyValueStore database. It stores a Key and a value.
'---------------------------------------------------------------------
kvs.Initialize(strShared, "Settings")
End Sub
Sub MapTouch_Touch(ViewTag As Object, Action As Int, X As Float, Y As Float, MotionEvent As Object) As Boolean
ToastMessageShow("Tapped location x = " & X & " and y = " & Y, True)
Return True
End Sub