O'Reilly logo

Xamarin Studio for Android Programming: A C# Cookbook by Mathieu Nayrolles

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

Exploring KitKat

KitKat is, at the time of writing this, the latest Android version on the market but should be very soon replaced by Lollipop. Kitkat runs 37.8 % of the Android phone as of November 2014, and therefore, you should be careful while using what it proposes as you are targeting a subset of Android users equipped with last generation phones.

Getting ready

To follow this recipe, create a new project called KitKat and create a new AVD running Android 4.4 to deploy your code. In order to create an AVD running Android 4.4, you'll need to download and install the corresponding SDK using the Android SDK Manager.

How to do it...

  1. In your MainActivity class, add the following code in the OnCreate() method:
    if(Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat) ...

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