MessageBox in monodroid

Displaying error messages with Android and MonoDroid

One of the most annoying things when I build a desktop app in .NET is MessageBox.Show() for displaying images or using a alert() in Javascript is that I have to click on the popup dialog to make it go away. I love the little messages at the bottom of an Android screen that come up, display some text, and then go away. Its a Toast. Here’s a simple call to make one display.

Toast.MakeText(this, "some info goes here", ToastLength.Short).Show();

In my case, I wanted to report an error, so I did this:

            catch (System.Exception e)
                // log the error to the android logs.
                Android.Util.Log.D("MEDIA_PLAYER", e.Message);
                Toast.MakeText(this, e.Message, ToastLength.Short).Show();


Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:


Stai commentando usando il tuo account Chiudi sessione / Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione / Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione / Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione / Modifica )

Connessione a %s...