Android Programming Tutorials

(Romina) #1

TUTORIAL 40


Seeking the Proper Level


The problem with the preceding tutorial is that it only works on Android


2.x. Specifically, our way of getting the mobile phone numbers will have


some issues on previous editions of Android, due to the way the contacts


engine was overhauled for Android 2.0.


That being said, we can fix this.


This tutorial will revamp the way we get the mobile numbers, to use


separate implementations that work on Android 1.x and Android 2.x.


Moreover, we will choose the proper implementation at runtime, ensuring


that a 1.x device does not accidentally use the 2.x APIs, or vice versa.


Step-By-Step Instructions


First, you need to have completed the previous tutorial. If you are


beginning the tutorials here, or if you wish to not use your existing work,


you can download a ZIP file with all of the tutorial results, and you can copy


the 39-SMS edition of LunchList to use as a starting point.


Step #1: Define an Interface for Mobile Numbers............................


We need two pieces of information from the contacts database:


371
Free download pdf