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

Exit app through back, open up again and click on picker: Exception

$
0
0

Hi,

I've recently started playing around with Xamarin. I have a small app with a picker. When I open the app and click on the picker, everything is fine. When I then leave the app through back button, open it again, and click on the picker, I get an exception:

08-15 19:51:56.358 I/MonoDroid( 6124): UNHANDLED EXCEPTION: Android.Views.WindowManagerBadTokenException: Exception of type 'Android.Views.WindowManagerBadTokenException' was thrown.
08-15 19:51:56.358 I/MonoDroid( 6124): at Android.Runtime.JNIEnv.CallVoidMethod (intptr,intptr) [0x00062] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.14-series/a5d57087/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:490
08-15 19:51:56.358 I/MonoDroid( 6124): at Android.App.Dialog.Show () [0x00043] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.14-series/a5d57087/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Android.App.Dialog.cs:2497
08-15 19:51:56.358 I/MonoDroid( 6124): at Xamarin.Forms.Platform.Android.PickerRenderer.OnClick () <IL 0x0015e, 0x00626>
08-15 19:51:56.358 I/MonoDroid( 6124): at Xamarin.Forms.Platform.Android.PickerRenderer/PickerListener.OnClick (Android.Views.View) <IL 0x00011, 0x00097>
08-15 19:51:56.358 I/MonoDroid( 6124): at Android.Views.View/IOnClickListenerInvoker.n_OnClick_Landroid_view_View_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.14-series/a5d57087/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Android.Views.View.cs:1840
08-15 19:51:56.358 I/MonoDroid( 6124): at (wrapper dynamic-method) object.e8441c49-4e50-4a04-9ee1-566b41d40288 (intptr,intptr,intptr) <IL 0x00017, 0x0001f>

I have set a breakpoint on the constructor of the page that contains the picker, and I can see that the picker correctly receives elements that are not null or anything like that:

        categoryPicker = new Picker
        {
            Title = "Category",
            HorizontalOptions = LayoutOptions.Fill
        };

        // Add all categories
        foreach (Category category in CategoryHandler.Categories)
        {
            categoryPicker.Items.Add(category.CategoryTitle);
        }

Viewing all articles
Browse latest Browse all 58056

Trending Articles



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