O'Reilly logo

Xamarin Mobile Application Development for Android - Second Edition by Nilanchala Panigrahy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding validation

Any nontrivial app will have some level of the validation required. The POIApp app is somewhat trivial, but we have a small set of rules we need to enforce that will facilitate the discussion:

Property

Rule

Name

This cannot be empty or null

Latitude

This contains a valid decimal number between -90 and 90

Longitude

This contains a valid decimal number between -180 and 180

Using the EditText.Error property

The EditText widget has a string property named Error, which simplifies the effort of displaying errors to the user, particularly if you want to be able to show all the fields with errors at once. The following screenshot displays the error received for leaving the Name field empty:

To use this facility, simply ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required