locked
How To Show A Loading Screen (Cross Platform) RRS feed

  • Question

  • User91457 posted

    Hi everyone! I want to show a loading overlay screen on my app till my function gets completed. I want to solve this in a cross platform way. Not with iOS specific or Android specific code. Thanks!

    Friday, April 3, 2015 7:28 AM

Answers

  • User19820 posted

    Xamarin Forms has a control called ActivityIndicator http://iosapi.xamarin.com/index.aspx?link=T%3AXamarin.Forms.ActivityIndicator

    This works if you don't have a requirement for a specific look, otherwise it should be pretty easy to make your own.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Friday, April 3, 2015 8:53 AM

All replies

  • User19820 posted

    Xamarin Forms has a control called ActivityIndicator http://iosapi.xamarin.com/index.aspx?link=T%3AXamarin.Forms.ActivityIndicator

    This works if you don't have a requirement for a specific look, otherwise it should be pretty easy to make your own.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Friday, April 3, 2015 8:53 AM
  • User91457 posted

    thank you very much!

    Friday, April 3, 2015 12:16 PM
  • User108520 posted

    You can use MVVM and the ViewModel's IsLoading property to bind an otherwise invisible Grid and ActivityIndicator over the content (by putting your whole page's content into a Grid, with the content being the first item, and the overlay being the second. Something like this:

    <ContentPage>
        <Grid>
            <StackLayout x:Name="Your content" />
            <Grid x:Name="loadingOverlay" IsVisible="{Binding IsLoading}">
                <ActivityIndicator IsRunning="{Binding IsLoading}" />
            </Grid>
        </Grid>
    </ContentPage>
    
    Friday, April 3, 2015 12:20 PM
  • User91457 posted

    Cant put grid in contentpage or stacklayout. I get error. I try to use it in CS file.

    Friday, April 3, 2015 12:28 PM
  • User181 posted

    Take a look at this example.

    Saturday, April 4, 2015 3:28 AM
  • User2148 posted

    I suggest you to use @AllanRitchie UserDialogs plugin. It has a "ShowLoading" method

    UserDialogs.Instance.ShowLoading("Attendi...");
    
    Friday, January 22, 2016 3:28 PM
  • User181774 posted

    @AlessandroCaliaro , I am using UserDialogs and facing issue: "at Microsoft.Phone.Controls.CustomMessageBox.ClosePopup(Boolean restoreOriginalValues)" at App.xaml.cs page in Windows project.

    Tuesday, March 15, 2016 7:35 AM
  • User2148 posted

    @Pavan7Parekh you should ask to @AllanRitchie

    Tuesday, March 15, 2016 8:10 AM
  • User216704 posted

    I want to add progress bar till the function gets completed.. and where to add the code of activity indicator and if we need to make a new xcml page then how to set it as launch screen?

    Wednesday, April 20, 2016 5:30 AM
  • User203004 posted

    @AllanRitchie Hi

    Iam developing an ipad application in xamarin.forms.I installed acr.user dialogs versions 4.1.0,4.2.1,4.3.4 .

    But while running the application iam getting object reference not set to an instance of an object error.

    Is there any other thing i should give?

     FreshIOC.Container.Register<IUserDialogs>(UserDialogs.Instance); Given this also
    
    Friday, December 2, 2016 8:51 AM
  • User76049 posted

    @SujaB

    Have you initialised in Android before trying to register in the IoC?

    Try adding UserDialogs.Init(this); to your MainActivity and try again.

    https://github.com/aritchie/userdialogs

    Friday, December 2, 2016 9:14 AM
  • User203004 posted

    @NMackay

    But iam using only IOS application.Then also i need to edit in android?

    Friday, December 2, 2016 9:16 AM
  • User76049 posted

    @SujaB

    Sorry, missed the iPad bit. The error does hint the library hasn't been instantiated although apparently you don't need to that anymore for iOS and Windows.

    I'll step out of this one, Allan will be able to assist you.

    Friday, December 2, 2016 9:22 AM
  • User203004 posted

    @NMackay @AllanRitchie

    Thank you so much.I was planning to use Activityindicator. Since Acr.Userdialogs has so many extra features i wanted to use that in my application

    I need to add one more point.I have installed xamarin .forms 2.0.0.6490 version

    Friday, December 2, 2016 9:25 AM
  • User203004 posted

    @NMackay @AllanRitchie

    Hi Some progress i have found.When i give this inside a command it is working fine.When i give this inside init function it is showing error.

    Friday, December 2, 2016 9:45 AM
  • User76049 posted

    @SujaB

    That's a pretty old version of Forms. You'll have to be careful which version of the plugin your using. I'm guessing your registering it in the IoC as you want to inject the interface into your viewmodels

    Friday, December 2, 2016 9:46 AM
  • User203004 posted

    @NMackay Sorry i didnot get your point.It will be because of xamarin.forms version?

    Friday, December 2, 2016 9:48 AM
  • User76049 posted

    @SujaB

    I'm guessing your using the latest version of AcrDialog, I'm just suggesting as your using an old version of Forms that you check that AcrDialog 6.3.2 is compatible fully with Forms 2.0.0, for example your Android project would fail as they have different dependencies to GooglePlayServices.

    Friday, December 2, 2016 9:51 AM
  • User76049 posted

    Maybe try adding UserDialogs.Init(this); to your main activity anyway.

    I can't assist any further.

    Friday, December 2, 2016 9:52 AM
  • User203004 posted

    @NMackay Iam using Acr.userdialogs version 4.2.1 and xamarin.forms version 2.0.0.6490

    Friday, December 2, 2016 9:53 AM
  • User187527 posted

    @SujaB update your version and look at the FAQ section on the github.com/aritchie/userdialogs

    Friday, December 2, 2016 9:09 PM
  • User372637 posted

    @AlessandroCaliaro said: I suggest you to use @AllanRitchie UserDialogs plugin. It has a "ShowLoading" method

    UserDialogs.Instance.ShowLoading("Attendi...");

    Hi sir,

    User Dialog not showing in center in iOS6 and iOS6+, what do for this,It's worked well for Android.

    Thanks.

    Monday, January 21, 2019 7:22 AM
  • User2148 posted

    I suggest to open an issue on github repo

    Monday, January 21, 2019 8:07 AM
  • User244838 posted

    HI guys In Android by using ACR.User Dialogs loaders are aligned vertically center but when it comes to iOS loaders are not coming center(coming at top).Can anyone help me to resolve this? Thank You Can you have any solution For me also same issue

    Thanks In Advance

    Thursday, June 13, 2019 5:39 AM