Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

ScrollView on Android - crash when parent reassigned

$
0
0

(I tried to post this before, but got a "need to review"-message, and like before, that never seems to happen.)

I have a ScrollView, which is attached to a contentview, and sometimes not (see it like a tabbed view where the tabs are chosen or not). When the view is created, all works fine. But if the "tab" is reassigned to the contentview (the scrollview is only a part of the view), I get below crash. On iOS it works fine.

The exception has been there since a few months (see other forum posts), but I need a good workaround soon to be able to release the app.

Java.Lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.

01-27 09:22:25.135 I/MonoDroid01-27 09:22:25.125 I/MonoDroid(30359): UNHANDLED EXCEPTION:
01-27 09:22:25.130 I/MonoDroid(30359): Java.Lang.IllegalStateException: Exception of type 'Java.Lang.IllegalStateException' was thrown.
01-27 09:22:25.130 I/MonoDroid(30359): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <IL 0x00011, 0x00068>
01-27 09:22:25.130 I/MonoDroid(30359): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue[]) [0x00084] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/49a04b96/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:896
01-27 09:22:25.130 I/MonoDroid(30359): at Android.Views.ViewGroup.AddView (Android.Views.View) [0x00070] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/49a04b96/source/monodroid/src/Mono.Android/platforms/android-17/src/generated/Android.Views.ViewGroup.cs:1663
01-27 09:22:25.130 I/MonoDroid(30359): at Xamarin.Forms.Platform.Android.ScrollViewContainer.set_ChildView (Xamarin.Forms.View) <IL 0x00054, 0x00203>
01-27 09:22:25.135 I/MonoDroid(30359): at Xamarin.Forms.Platform.Android.ScrollViewRenderer.LoadContent () <IL 0x00011, 0x00083>
01-27 09:22:25.135 I/MonoDroid(30359): at Xamarin.Forms.Platform.Android.ScrollViewRenderer.SetElement (Xamarin.Forms.VisualElement) <IL 0x000ab, 0x0047b>
01-27 09:22:25.135 I/MonoDroid(30359): at Xamarin.Forms.Platform.Android.RendererFactory.GetRenderer (Xamarin.Forms.VisualElement) <IL 0x00022, 0x0013f>
01-27 09:22:25.135 I/MonoDroid(30359): at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement,Xamarin.Forms.Platform.Android.IVisualElementRenderer,Xamarin.Forms.Platform.Android.RendererPool,bool) <IL 0x00011, 0x000ff>
01-27 09:22:25.140 I/MonoDro01-27 09:22:25.135 I/MonoDroid(30359): at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement,Xamarin.Forms.VisualElement) <IL 0x00116, 0x00827>
01-27 09:22:25.135 I/MonoDroid(30359): at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () <IL 0x0000d, 0x0008b>
01-27 09:22:25.135 I/MonoDroid(30359): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager) <0x00083>
An unhandled exception occured.
01-27 09:22:25.135 I/MonoDroid(30359): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.SetElement (Xamarin.Forms.View) <0x006a3>
01-27 09:22:25.135 I/MonoDroid(30359): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement) <0x0012b>
01-27 09:22:25.135 I/MonoDroid(30359): at Xamarin.Forms.Platform.Android.RendererFactory.GetRenderer (Xamarin.Forms.VisualElement) <IL 0x00022, 0x0013f>
01-27 09:22:25.135 I/MonoDroid(30359): at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement,Xamarin.Forms.Platform.Android.IVisualElementRenderer,Xamarin.Forms.Platform.Android.RendererPool,bool) <IL 0x00011, 0x000ff>
01-27 09:22:25.135 I/MonoDroid(30359): at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement,Xamarin.Forms.VisualElement) <IL 0x00116, 0x00827>
01-27 09:22:25.135 I/MonoDroid(30359): at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () <IL 0x0000d, 0x0008b>
01-27 09:22:25.135 I/MonoDroid(30359): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager) <0x00083>
01-27 09:22:25.135 I/MonoDroid(30359): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.SetElement (Xamarin.Forms.View) <0x006a3>
01-27 09:22:25.135 I/MonoDroid(30359): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement) <0x0012b>
01-27 09:22:25.135 I/MonoDroid(30359): at Xamarin.Forms.Platform.Android.RendererFactory.GetRenderer (Xamarin.Forms.VisualElement) <IL 0x00022, 0x0013f>
01-27 09:22:25.135 I/MonoDroid(30359): at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement,Xamarin.Forms.Platform.Android.IVisualElementRenderer,Xamarin.Forms.Platform.Android.RendererPool,bool) <IL 0x00011, 0x000ff>
01-27 09:22:25.135 I/MonoDroid(30359): at Xamarin.Forms.Platform.Android.VisualElementPackager.OnChildAdded (object,Xamarin.Forms.ElementEventArgs) <IL 0x00014, 0x000eb>
01-27 09:22:25.135 I/MonoDroid(30359): at Xamarin.Forms.Element.OnChildAdded (Xamarin.Forms.Element) <IL 0x00037, 0x00187>
01-27 09:22:25.135 I/MonoDroid(30359): at Xamarin.Forms.Layout.OnInternalAdded (Xamarin.Forms.View) <IL 0x00014, 0x000ef>
01-27 09:22:25.135 I/MonoDroid(30359): at Xamarin.Forms.Layout.InternalChildrenOnCollectionChanged (object,System.Collections.Specialized.NotifyCollectionChangedEventArgs) <IL 0x0008a, 0x0068b>
01-27 09:22:25.135 I/MonoDroid(30359): at System.Collections.ObjectModel.ObservableCollection`1<Xamarin.Forms.Element>.OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs) <0x000f7>
01-27 09:22:25.140 I/MonoDroid(30359): at System.Collections.ObjectModel.ObservableCollection`1<Xamarin.Forms.Element>.InsertItem (int,Xamarin.Forms.Element) <0x000d3>
01-27 09:22:25.140 I/MonoDroid(30359): at System.Collections.ObjectModel.Collection`1<Xamarin.Forms.Element>.Add (Xamarin.Forms.Element) <0x000c3>
01-27 09:22:25.140 I/MonoDroid(30359): at Xamarin.Forms.ContentView.set_Content (Xamarin.Forms.View) <IL 0x0004a, 0x0019f>
01-27 09:22:25.140 I/MonoDroid(30359): at app.Controllers.TabView.OnTabPropertyChanged (object,System.ComponentModel.PropertyChangedEventArgs) [0x00064] in z:\development\app\app\app\Controllers\TabView.cs:290
01-27 09:22:25.140 I/MonoDroid(30359): at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00067>
01-27 09:22:25.140 I/MonoDroid(30359): at app.Controllers.Tab.RaisePropertyChanged (string) [0x0000e] in z:\development\app\app\FiscaalMemoApp\Controllers\ITabView.cs:127
01-27 09:22:25.140 I/MonoDroid(30359): at app.Controllers.Tab.set_Selected (bool) [0x0001a] in z:\development\FiscaalMemoApp\FiscaalMemoApp\FiscaalMemoApp\Controllers\ITabView.cs:103
01-27 09:22:25.140 I/MonoDroid(30359): at app.Controllers.Tab.<get_TabImage>b__2 () [0x0000b] in z:\development\app\app\app\Controllers\ITabView.cs:147
01-27 09:22:25.140 I/MonoDroid(30359): at Xamarin.Forms.Command/<>c__DisplayClass2.<.ctor>b__0 (object) <IL 0x00006, 0x00057>
01-27 09:22:25.140 I/MonoDroid(30359): at Xamarin.Forms.Command.Execute (object) <IL 0x00007, 0x0005b>
01-27 09:22:25.140 I/MonoDroid(30359): at Xamarin.Forms.TapGestureRecognizer.SendTapped (Xamarin.Forms.View) <IL 0x0001f, 0x0014b>
01-27 09:22:25.140 I/MonoDroid(30359): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.Image>.Android.Views.View.IOnClickListener.OnClick (Android.Views.View) <0x0031f>
01-27 09:22:25.140 I/MonoDroid(30359): at Android.Views.View/IOnClickListenerInvoker.n_OnClick_Landroid_view_View_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/49a04b96/source/monodroid/src/Mono.Android/platforms/android-17/src/generated/Android.Views.View.cs:1791
01-27 09:22:25.140 I/MonoDroid(30359): at (wrapper dynamic-method) object.bbfeefcb-eb6e-4cdb-a057-f11af1fe46a2 (intptr,intptr,intptr) <IL 0x00017, 0x00043>
01-27 09:22:25.140 I/MonoDroid(30359):   --- End of managed exception stack trace ---
01-27 09:22:25.140 I/MonoDroid(30359): java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
01-27 09:22:25.140 I/MonoDroid(30359):  at android.view.ViewGroup.addViewInner(ViewGroup.java:3672)
01-27 09:22:25.140 I/MonoDroid(30359):  at android.view.ViewGroup.addView(ViewGroup.java:3543)
01-27 09:22:25.140 I/MonoDroid(30359):  at android.view.ViewGroup.addView(ViewGroup.java:3488)
01-27 09:22:25.140 I/MonoDroid(30359):  at android.view.ViewGroup.addView(ViewGroup.java:3464)
01-27 09:22:25.140 I/MonoDroid(30359):  at xamarin.forms.platform.android.VisualElementRenderer_1.n_onClick(Native Method)
01-27 09:22:25.140 I/MonoDroid(30359):  at xamarin.forms.platform.android.VisualElementRenderer_1.onClick(VisualElementRenderer_1.java:54)
01-27 09:22:25.140 I/MonoDroid(30359):  at android.view.View.performClick(View.java:4232)
01-27 09:22:25.140 I/MonoDroid(30359):  at android.view.View$PerformClick.run(View.java:17318)
01-27 09:22:25.145 I/MonoDroid(30359):  at android.os.Handler.handleCallback(Handler.java:615)
01-27 09:22:25.145 I/MonoDroid(30359):  at android.os.Handler.dispatchMessage(Handler.java:92)
01-27 09:22:25.145 I/MonoDroid(30359):  at android.os.Looper.loop(Looper.java:137)
01-27 09:22:25.145 I/MonoDroid(30359):  at android.app.ActivityThread.main(ActivityThread.java:4921)
01-27 09:22:25.145 I/MonoDroid(30359):  at java.lang.reflect.Method.invokeNative(Native Method)
01-27 09:22:25.145 I/MonoDroid(30359):  at java.lang.reflect.Method.invoke(Method.java:511)
01-27 09:22:25.145 I/MonoDroid(30359):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
01-27 09:22:25.145 I/MonoDroid(30359):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
01-27 09:22:25.145 I/MonoDroid(30359):  at dalvik.system.NativeStart.main(Native Method)
01-27 09:22:27.870 E/mono    (30359): 

Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>