Personally I like the rg.plugins.popups package for popups. And you can make a "BusyPopup" to reuse for the needs you describe. That way you can have a semi-transparent busy indicator on top of your page to act as a barrier; keeping people from banging on buttons while the app is busying handling REST calls and so on.
but how to display progress before calling Api and hide it after finishing calling Api
I did the following
UserDialogs.Instance.ShowLoading(); before calling api
and
UserDialogs.Instance.HideLoading(); after calling api
but nothing happened, the action happened after clicked event has been finished. so if i removed this line "UserDialogs.Instance.HideLoading()" the progress will appear
@VictorRangel.4469
Please don't hijack other people's threads just because it kinda, sorta has a couple words that maybe sorta sounds like your question.
@sarveshs What part of Don't hijack other people's threads posted right above where you posted - did you not understand? Maybe you are new to the internet or forums such as this so let me bring you up to speed: Doing that is considered very rude. Its the equivalent of jumping into a conversation other people are having and just taking it over for your own problems.
FYI: If you read the documentation on ActivityIndicator you'll see it has to be raised from the Page currently being shown.
@ClintStLaurent said: @VictorRangel.4469
Please don't hijack other people's threads just because it kinda, sorta has a couple words that maybe sorta sounds like your question.
Probably late on this but have been battling with the activity thing for a long time and finally got it to work as follows:
Rather than using the standard Xamarin ActivityIndicator (which will also work) I installed Nuget Acr.UserDialogs and used the ShowLoading and HideLoading methods (just cleaner code for lazy me). The trick was to put my long running task into a Task that is not part of the UI thread and here is some code that works great in a shared project, but only fully tested with Android (You have to do an init in MainActivity.cs for Android - Nuget readme gives you all that):
My job kicks off with the user trying to register and hitting the button. So I made the button event handler async:
(Excuse my ignoring Xamarin and C# naming conventions, been programming for 35 years so old habits die hard)
//Here I do some input validation first and bail out if needed prior to calling my web client interface that takes the time
//Start the busy thingy
UserDialogs.Instance.ShowLoading("Checking");
//Call a Task that checks on a server for database entries
await createNewUser();
//when done, hide the thingy
UserDialogs.Instance.HideLoading();
The task will set a string (friend variable to all in the class) called msg if anything goes wrong in order for the user to be informed
if (msg != "")
await DisplayAlert("Error", msg, "OK");
}
//The task called is declared like this
private async Task createNewUser()
{
await Task.Delay(250)
.ContinueWith(task =>
{
try
{
//Here I do my calls to my version of an API using JSON stuff, and this normally takes a few seconds. If anything goes wrong, a message goes into var msg and task is terminated
}
catch (Exception ex)
{
msg = ex.Message;
}
});
}
Answers
I suggest to use https://github.com/aritchie/userdialogs
the "Loading" method...
@KavyaS
Forms also has a built in Activity indicator.
Personally I like the rg.plugins.popups package for popups. And you can make a "BusyPopup" to reuse for the needs you describe. That way you can have a semi-transparent busy indicator on top of your page to act as a barrier; keeping people from banging on buttons while the app is busying handling REST calls and so on.

@ClintStLaurent how you use it?
@RefkaBenmahmoud if you go to rg.plugin's github site you find some samples
but how to display progress before calling Api and hide it after finishing calling Api
I did the following
UserDialogs.Instance.ShowLoading(); before calling api
and
UserDialogs.Instance.HideLoading(); after calling api
but nothing happened, the action happened after clicked event has been finished. so if i removed this line "UserDialogs.Instance.HideLoading()" the progress will appear
what shall i do ?!
you should post your code.
Is it an async / await code?
I usually use something like
Does not work for me, it simply does not appear. Do you have any suggestions?
Have you also installed the package in your iOS and Android projects? and have you added this line into your Droids MainActivity.cs?
UserDialogs.Init(this);
Thanks
I forgot it!
Hi, someone who can tell me how to use Arc in Xamarin.Form, I get an error in MainActivity
protected override void OnCreate(Bundle bundle)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
UserDialogs.Init(this);
base.OnCreate(bundle);
DevExpress.Mobile.Forms.Init();
@VictorRangel.4469
Please don't hijack other people's threads just because it kinda, sorta has a couple words that maybe sorta sounds like your question.
Please start your own question.
Hi i am using
public interface IProgress
{
void Show(string message);
void Hide();
}
[assembly:Dependency(typeof(Progress))]
namespace MyDemo.Droid.DependencyServices
{
public class Progress : IProgress
{
public void Hide()
{
AndHUD.Shared.Dismiss();
}
}
and i use like that
but it not show the speeing wheel some time
@sarveshs What part of Don't hijack other people's threads posted right above where you posted - did you not understand? Maybe you are new to the internet or forums such as this so let me bring you up to speed: Doing that is considered very rude. Its the equivalent of jumping into a conversation other people are having and just taking it over for your own problems.
Please start your own thread for your issue. Also, please use markdown to properly mark the code in your post so the site doesn't try to interpret it as something it should be rendering.
FYI: If you read the documentation on
ActivityIndicator
you'll see it has to be raised from thePage
currently being shown.@ClintStLaurent sorry for that
Probably late on this but have been battling with the activity thing for a long time and finally got it to work as follows:
Rather than using the standard Xamarin ActivityIndicator (which will also work) I installed Nuget Acr.UserDialogs and used the ShowLoading and HideLoading methods (just cleaner code for lazy me). The trick was to put my long running task into a Task that is not part of the UI thread and here is some code that works great in a shared project, but only fully tested with Android (You have to do an init in MainActivity.cs for Android - Nuget readme gives you all that):
My job kicks off with the user trying to register and hitting the button. So I made the button event handler async:
(Excuse my ignoring Xamarin and C# naming conventions, been programming for 35 years so old habits die hard)
//Here I do some input validation first and bail out if needed prior to calling my web client interface that takes the time
//Start the busy thingy
UserDialogs.Instance.ShowLoading("Checking");
//Call a Task that checks on a server for database entries
await createNewUser();
//when done, hide the thingy
UserDialogs.Instance.HideLoading();
The task will set a string (friend variable to all in the class) called msg if anything goes wrong in order for the user to be informed
if (msg != "")
await DisplayAlert("Error", msg, "OK");
}
//The task called is declared like this
private async Task createNewUser()
{
await Task.Delay(250)
.ContinueWith(task =>
{
try
{
Hope it's useful. First time I posted something