SfBusyIndicator in a Fragment

Hello,

In my project I have five Fragment layouts and when the user chooses the last Fragment the SfBusyIndicator must be shown. I tried it with the next code in MainActivity.cs but the app crashes without an error and without showing the SfBusyIndicator:

private async void ShowBusyIndicator(Android.Views.View viewTabLayout4)
        {
            var busyIndicator = new SfBusyIndicator(viewTabLayout4.Context);
            busyIndicator.IsBusy = true;
            busyIndicator.ViewBoxHeight = 100;
            busyIndicator.ViewBoxWidth = 100;
            busyIndicator.AnimationType = AnimationTypes.SingleCircle;
            busyIndicator.Title = "Laden...";
            busyIndicator.TextSize = 50;
            var layout = viewTabLayout4.FindViewById<ScrollView>(Resource.Id.ScrollView4);
            layout.AddView(busyIndicator);
            await Task.Delay(5000);
            busyIndicator.IsBusy = false;
            busyIndicator.Visibility = Android.Views.ViewStates.Invisible;
        }

Do you have a sample implementing the SfBusyIndicator in Fragments?

3 Replies

VA Vinnalan Aravazhi Syncfusion Team January 18, 2018 01:09 PM UTC

Hi Vince,

We have checked your requirement "SfBusyIndicator in a Fragment" from our side and we have created a sample based on your requirement.

Please find the sample from the below link.


 
So, Could you please provide the modified sample which replicates the reported issue "App crashes without an error and without showing the SfBusyIndicator".

It will help us to provide appropriate solution on this.

Regards,
Vinnalan K A.



VI Vince January 19, 2018 12:00 PM UTC

Hi Vinnalan,

I found my error. After adding the code "layout.RemoveAllViews();" it worked because the View in my Fragment was occupied by another Syncfusion control.

So I changed my code in:

private async void ShowBusyIndicator(Android.Views.View viewTabLayout4)
        {
            var busyIndicator = new SfBusyIndicator(viewTabLayout4.Context);
            busyIndicator.IsBusy = true;
            busyIndicator.ViewBoxHeight = 100;
            busyIndicator.ViewBoxWidth = 100;
            busyIndicator.AnimationType = AnimationTypes.SingleCircle;
            busyIndicator.Title = "Laden...";
            busyIndicator.TextSize = 50;
            var layout = viewTabLayout4.FindViewById<ScrollView>(Resource.Id.ScrollView4);
            layout.RemoveAllViews();
            layout.AddView(busyIndicator);
            await Task.Delay(5000);
            busyIndicator.IsBusy = false;
            busyIndicator.Visibility = Android.Views.ViewStates.Invisible;
        }

Thanks for your support.


VA Vinnalan Aravazhi Syncfusion Team January 22, 2018 08:38 AM UTC

Hi Vince,

Thanks for the update.

We are glad to know that you have achieved your requirement. Please let us know if you have any other queries.

Regards,
Vinnalan K A.

Loader.
Up arrow icon