Hello,
For select a list item in list view, I want to use this java code in b4a with java object.
But B4A gives this error:
What can I do with this issue?
For select a list item in list view, I want to use this java code in b4a with java object.
B4X:
Listview.getAdapter().getView(Index, null, null).performClick();
B4X:
Dim jo As JavaObject = LstView
jo=jo.RunMethodJO("getAdapter", Null)
jo=jo.RunMethodJO("getView", Array(Index, Null, Null))
jo.RunMethod("performClick", Null)
But B4A gives this error:
B4X:
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
main_lstclick (B4A line: 268)
jo=jo.RunMethodJO("getView", Array(Index, Null, Null)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:130)
at anywheresoftware.b4j.object.JavaObject.RunMethodJO(JavaObject.java:137)
at b4a.example.main._lstclick(main.java:710)
at b4a.example.main._pnltest_touch(main.java:778)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
at anywheresoftware.b4a.BA$2.run(BA.java:299)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5253)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.view.ViewGroup.getContext()' on a null object reference
at anywheresoftware.b4a.objects.SimpleListAdapter.getView(SimpleListAdapter.java:85)
... 18 more
java.lang.reflect.InvocationTargetException
What can I do with this issue?
Last edited: