FATAL EXCEPTION after a Fling Touch Event

ChrisJohnson.8155ChrisJohnson.8155 USMember ✭✭
edited May 2014 in Xamarin.Android

I'm getting a fatal exception after a Fling event gets processed for the 3rd time. I stepped through my OnFling() event code and it finishes completely.

Here's the section about it from the "Application Output" console:

[AndroidRuntime] Shutting down VM
[AndroidRuntime] FATAL EXCEPTION: main
[AndroidRuntime] java.lang.ClassCastException: android.view.ViewGroup$LayoutParams
[AndroidRuntime] at android.widget.RelativeLayout$DependencyGraph.findRoots(RelativeLayout.java:1303)
[AndroidRuntime] at android.widget.RelativeLayout$DependencyGraph.getSortedViews(RelativeLayout.java:1250)
[AndroidRuntime] at android.widget.RelativeLayout.sortChildren(RelativeLayout.java:281)
[AndroidRuntime] at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:303)
[AndroidRuntime] at android.view.View.measure(View.java:8313)
[AndroidRuntime] at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
[AndroidRuntime] at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)
[AndroidRuntime] at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:701)
[AndroidRuntime] at android.widget.LinearLayout.onMeasure(LinearLayout.java:311)
[AndroidRuntime] at android.view.View.measure(View.java:8313)
[AndroidRuntime] at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:581)
[AndroidRuntime] at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:365)
[AndroidRuntime] at android.view.View.measure(View.java:8313)
[AndroidRuntime] at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
[AndroidRuntime] at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)
[AndroidRuntime] at android.widget.LinearLayout.measureVertical(LinearLayout.java:386)
[AndroidRuntime] at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
[AndroidRuntime] at android.view.View.measure(View.java:8313)
[AndroidRuntime] at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
[AndroidRuntime] at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
[AndroidRuntime] at android.view.View.measure(View.java:8313)
[AndroidRuntime] at android.widget.LinearLayout.measureVertical(LinearLayout.java:531)
[AndroidRuntime] at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
[AndroidRuntime] at android.view.View.measure(View.java:8313)
[AndroidRuntime] at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
[AndroidRuntime] at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
[AndroidRuntime] at android.view.View.measure(View.java:8313)
[AndroidRuntime] at android.view.ViewRoot.performTraversals(ViewRoot.java:839)
[AndroidRuntime] at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
[AndroidRuntime] at android.os.Handler.dispatchMessage(Handler.java:99)
[AndroidRuntime] at android.os.Looper.loop(Looper.java:123)
[AndroidRuntime] at android.app.ActivityThread.main(ActivityThread.java:3683)
[AndroidRuntime] at java.lang.reflect.Method.invokeNative(Native Method)
[AndroidRuntime] at java.lang.reflect.Method.invoke(Method.java:507)
[AndroidRuntime] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
[AndroidRuntime] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
[AndroidRuntime] at dalvik.system.NativeStart.main(Native Method)

Another note, the third time the event is performed is the same as the first time, left-side of the screen to right. The second is right-left.

I'm doing this to bring up a LinearLayout object when the user wants to, and I'm changing the Visibility property depending on which direction the gesture was.

All help is appreciated.

Posts

  • ChrisJohnson.8155ChrisJohnson.8155 USMember ✭✭

    I fixed it. I was recreating a child LinearLayout the wrong way which is why it was throwing an error on the 3rd time. I moved a couple lines of code around and the issue is gone.

Sign In or Register to comment.