Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

[FilePickerActivity] not attached to window manager xamarin forms

$
0
0

Hi, I am trying to use the CrossFilePicker to allow a user to select a file from their device and receive this error message shortly after selecting a file. The setup that I have is that file management code is per platform (Android, UWP) and is injected into my ViewModels that require file management via an Interface and AutoFac. The CrossFilePicker is only used in the Android file management code with UWP having a different implementation.

The code in question is:

    public class AndroidFilePicker : IFileManagement
    {
        public async Task<List<FileDataDto>> PickFilesAsync(string temporaryTargetFolder)
        {
            var result = new List<FileDataDto>();
            Plugin.FilePicker.Abstractions.FileData fileData = await CrossFilePicker.Current.PickFile(AndroidConstants.AllowedFileExtensions);

            if (fileData != null)
            {
                ...
            }

            return result;
        }

Would be great to hear if anyone knows why this exception may be occuring and how I could prevent this?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



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