0

I want to show the user a flattened pick list of all their contacts phone numbers and it must work from versions 1.6 up. I have read the related questions on SO and the Android documentation for Eclair.

The problem is, even splitting my code into a factory class and specific implementations does not work for me because using Contacts.CONTENT_URI only shows contacts not individual numbers. What I need is this for version 1.6

Intent intent = new Intent(Intent.ACTION_PICK, Phones.CONTENT_URI);
startActivityForResult(intent, REQUEST_PICK_CONTACT);

And the equivalent for 2.0 and above.

Even if I get their example to work, by building against the 2.1 API am I not stopping my app being visible on the Market to users with earlier versions of the OS? I can't launch it against a 1.6 emulator, for example.

rekire
  • 47,260
  • 30
  • 167
  • 264
Rob Kent
  • 5,183
  • 4
  • 33
  • 54
  • As an aside, to the Android developers: backward compatibility means that your code continues to work on the new API. When you said that the old API was deprecated but 'compatible', you were not telling the truth. Backwards compatibility has been one of the central principles of .NET from day one and they have never broken that. Any code you wrote for .NET 1.0 will still work on .NET 4.0. What you should have done with the Contacts API is ensured that the code I posted above continued to produce the same results in the later APIs. – Rob Kent Jun 02 '10 at 22:57

1 Answers1

0

As per the Documentation contacts class has been depreciated, instead of that you have to use ContactsContract class to read the contacts. A perfect example is found at How to read contacts on Android 2.0

Community
  • 1
  • 1
Vamsi
  • 5,853
  • 6
  • 29
  • 36
  • Thanks. I had already read that article but I want the equivalent of the code I posted which displays a native activity that shows a flattened list of phone numbers only, without email or any other contacts. Two problems: how to display that activity and how to deploy an app that targets 2.0+ to market users on 1.6 (and to the 1.6 emulator). – Rob Kent Jun 02 '10 at 06:54