Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

ProgressDialog in OnDraw

nkuznetsovnkuznetsov USMember
edited August 2014 in Xamarin.Android

Hi everyone.

Somewhere within my layout I have a custom control, which is essentially a container for a bunch of graphics to happen inside of it. In it's OnDraw method it does a lot of drawing, that takes ~4-5s. What happens is when activity loads, the control starts doing its work, there is no indication to the user that work is being done (i. e. graphics is being drawn). So after that 4-5s delay the graphics appears on the screen all of a sudden, which isn't very user-friendly.

Is it possible to display a progress dialog indicator while the drawing occurs (Android.App.ProgressDialog)? Like so:

protected override void OnDraw(Canvas c)

        // lots of drawing


I tried the above, which yields no effect at all (tried RunOnUiThread(delegate() { }); also).

The control class has access to the parent context (Activity). Activity itself uses progress dialogs for its own operations but when I try to access them from my control, like so -


they don't show up.



  • RaphaelSchindlerRaphaelSchindler USMember ✭✭✭

    Try this ((YourParentActivity)Activity).ShowProgressDialog() where the ShowProgressDialog() must be public.

Sign In or Register to comment.