Cross-Platform Progress HUD for Android & iOS With Xamarin
February 9, 2014

If you develop native mobile apps using Xamarin you quite likely have used BTProgressHUD for iOS or AndHUD for Android. These are great components for displaying work-in-progress dialogs or toast messages.

While the components have similar APIs nevertheless they are different and in different namespaces and thus create an issue if you”re trying to code share between the two platforms. I hit up Nic and Jon on twitter this week and Jon suggested writing a class that wraps both.

I wrote XHUD.HUD as a result. It”s quite simple as it mimics the underlying APIs and unifies the slight differences between the 2 APIs. However, I didn”t map every variation of the APIs and thus it will need to be extended.

An example usage is shown below:

XHUD.HUD.Show("Loading Data");

var items = await CommonData.Load(param);

XHUD.HUD.Dismiss();

Both Nic and Jon have added XHUD to their github repositories here: https://github.com/redth/andhud and https://github.com/nicwise/BTProgressHUD

# Longer Term

Longer term it would be nice to see Xamarin.Mobile encompass more things like this. Having said that it doesn”t seem like it is actively being developed. So for now we have XHUD.HUD but I”m not crazy about the namespace XHUD as it seems redundant and too narrowly focused. Perhaps XPlat as the namespace and it contains HUD, AlertDialog, etc? We”ll see.