Activity indicator gets stuck while navigating xamarin forms

I of m using xamarin forms 2.3.4.247 shared project. In my login page im navigating my page to another. while this page is rendering i

m, indicating activity indicator on the front page. But unfortunately Activity Indicator Stucks And After After a couple of seconds, the second page loads.i ve tried these codes below and i got nothing.All of these codes are running into an async command.i

m is testing my application on a real Android device.

1

activityIndicator.IsRunnig=true;
    new System.Threading.Thread(new System.Threading.ThreadStart(() =>
                        {
                            Navigation.PushAsync(new DeviceLoginView());
                        })).Start();

      

2

activityIndicator.IsRunnig=true;
Device.BeginInvokeOnMainThread(async () =>
                {
                    await Navigation.PushAsync(new DeviceLoginView());
                });

      

3

 activityIndicator.IsRunnig=true;
 await Navigation.PushAsync(new DeviceLoginView());

      

+3


source to share


2 answers


i Finally, I was able to solve this problem correctly. you can execute all your asynchronous jobs in the Task.Run () method to run all of them on a new thread and NOT on the UI thread



+1


source


This issue is due to the fact that your activity indicator is in the UI of the old page and not on the new page, so when you click, the old page is no longer displayed. For your desired output, you can use this plugin to save loading during transition https://github.com/aritchie/userdialogs



0


source







All Articles