Android Question anyone can help me?

khosrwb

Active Member
Licensed User
Longtime User
what is problem in my app?
when I delete the this code my app worked truly:confused:
Code: Copy
For i=0 To 10
    listview1.AddTwoLines(i,i)
Next
 

Attachments

  • n.zip
    n.zip
    25.5 KB · Views: 330
Next is fine without the "I"

@khosrwb : shouldn't ListView1 been Initialized before to fill it ?
 
Upvote 0
what is problem in my app?
when I delete the this code my app worked truly:confused:
Code: Copy
For i=0 To 10
    listview1.AddTwoLines(i,i)
Next


those lines are ok, it has something to do with the class, i dont have those libs so i cannot not test it.

btw you should put "if firsttime = true then..." in activity create unless your code will every activity start load 10 new items to your listview
or you can clear the items before you add new items...
 
Upvote 0
Upvote 0
when i try the code my listview get filled like it should be, only after i slide i get an error (something with class... but again i have not those libs so i removed the LockScreenController lines)

and i also use b4a 4.3
 
Upvote 0
... load 10 new items to your listview
or you can clear the items before you add new items...

actually 0 to 10 will cycle 11 times thus going from 0 to 10 = 11 items
 
Upvote 0
you are right, i believe he understood my point ;)
I just mentioned that because i have too many times forgoten than an index begins at 0. And that an array lenght counts the actual amout of items in it, so the last index is length - 1!
 
Upvote 0
when I run this program and use from them
show error on line 469 in class module (( ClsSlidingSideBar ))
and when remove this code from Activity module (( LockScreen )) program worked truly
Code: Copy
For i=0 To 10
    listview1.AddTwoLines(i,i)
Next
I don't know what is the problem :(
please help me
 
Upvote 0
Please list the actual error message that you recieve.
 
Upvote 0
on the log show this error :

LogCat connected to: B4A-Bridge: Sony Ericsson ST18
--------- beginning of /dev/log/system
--------- beginning of /dev/log/main
Installing file.
PackageAdded: package:com.datasteam.b4a.system.lockscreen.sample
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (lockscreen) Create, isFirst = true **
** Activity (lockscreen) Resume **
clsslidingsidebar_getviewatxy (B4A line: 469)
If X >= v.Left And X <= v.Left + v.Width And
java.lang.ClassCastException: android.widget.AbsListView$LayoutParams cannot be cast to anywheresoftware.b4a.BALayout$LayoutParams
at anywheresoftware.b4a.objects.ViewWrapper.getLeft(ViewWrapper.java:150)
at com.datasteam.b4a.system.lockscreen.sample.clsslidingsidebar._getviewatxy(clsslidingsidebar.java:1232)
at com.datasteam.b4a.system.lockscreen.sample.clsslidingsidebar._gesture_ontouch(clsslidingsidebar.java:859)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at anywheresoftware.b4a.agraham.reflection.Reflection$7.onTouch(Reflection.java:1118)
at android.view.View.dispatchTouchEvent(View.java:5559)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2052)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1813)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2058)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1785)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2058)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1785)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2058)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1785)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2058)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1785)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1931)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1390)
at android.app.Activity.dispatchTouchEvent(Activity.java:2364)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1879)
at android.view.View.dispatchPointerEvent(View.java:5766)
at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:2890)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2466)
at android.view.ViewRootImpl.processInputEvents(ViewRootImpl.java:845)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:859)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4441)
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)
clsslidingsidebar_getviewatxy (B4A line: 469)
If X >= v.Left And X <= v.Left + v.Width And

java.lang.ClassCastException: android.widget.AbsListView$LayoutParams cannot be cast to anywheresoftware.b4a.BALayout$LayoutParams
at anywheresoftware.b4a.objects.ViewWrapper.getLeft(ViewWrapper.java:150)
at com.datasteam.b4a.system.lockscreen.sample.clsslidingsidebar._getviewatxy(clsslidingsidebar.java:1232)
at com.datasteam.b4a.system.lockscreen.sample.clsslidingsidebar._gesture_ontouch(clsslidingsidebar.java:859)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at anywheresoftware.b4a.agraham.reflection.Reflection$7.onTouch(Reflection.java:1118)
at android.view.View.dispatchTouchEvent(View.java:5559)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2052)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1813)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2058)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1785)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2058)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1785)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2058)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1785)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2058)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1785)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1931)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1390)
at android.app.Activity.dispatchTouchEvent(Activity.java:2364)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1879)
at android.view.View.dispatchPointerEvent(View.java:5766)
at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:2890)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2466)
at android.view.ViewRootImpl.processInputEvents(ViewRootImpl.java:845)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2475)
at android.os.Handler.dispatchMessage(Handler.java:99)
at anywheresoftware.b4a.Msgbox.waitForMessage(Msgbox.java:198)
at anywheresoftware.b4a.Msgbox.debugWait(Msgbox.java:157)
at anywheresoftware.b4a.debug.Debug.wait(Debug.java:213)
at anywheresoftware.b4a.debug.Debug.reachBP(Debug.java:260)
at anywheresoftware.b4a.debug.Debug.ErrorCaught(Debug.java:145)
at com.datasteam.b4a.system.lockscreen.sample.clsslidingsidebar._getviewatxy(clsslidingsidebar.java:1248)
at com.datasteam.b4a.system.lockscreen.sample.clsslidingsidebar._gesture_ontouch(clsslidingsidebar.java:859)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at anywheresoftware.b4a.agraham.reflection.Reflection$7.onTouch(Reflection.java:1118)
at android.view.View.dispatchTouchEvent(View.java:5559)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2052)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1813)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2058)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1785)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2058)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1785)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2058)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1785)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2058)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1785)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1931)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.
Message longer than Log limit (4000). Message was truncated.
java.lang.ClassCastException: android.widget.AbsListView$LayoutParams cannot be cast to anywheresoftware.b4a.BALayout$LayoutParams
raiseEvent for gesture_ontouch returned null
 
Last edited:
Upvote 0
clsslidingsidebar_getviewatxy (B4A line: 469)
If X >= v.Left And X <= v.Left + v.Width And
java.lang.ClassCastException:android.widget.AbsListView$LayoutParams cannot be cast to anywheresoftware.b4a.BALayout$LayoutParams
I'm sorry but I've not got my PC to hand at the moment so can't check the code you have already uploaded. Please show the code on line 469 where the error occurs. It's it possible that you are trying to access a property of the ListView that doesn't exist and so throwing the ClassCast error?
 
Upvote 0
error occured in this sub :

Code: Copy
Private Sub GetViewAtXY(X As Float, Y As Float) As Object
    For Each v As View In pnlContent.GetAllViewsRecursive
        If X >= v.Left And X <= v.Left + v.Width And Y >= v.Top And Y <= v.Top + v.Height Then       'this line is 469
            Return v
        End If   
      Next
    Return Null
End Sub
 
Upvote 0
Back
Top