Is there an API to determine the phone's version of Android? For now,
I'm using try-catch. Sucky but works.

Also, my 2.0 built APK does not run on my G1 phone. Maybe it's
something I've done but I haven't dug into it. Maybe that's what you
meant by "intelligent" class loading.... do you mean Class.forName()
or Class.loadClass() or whatever its called instead of import
blahblh;?

For now I'm having to reverse engineer the URI for 2.0 and use it so I
have files which build on 1.5 but run with 2.0.

Thanks!
Tim

On Thu, Nov 26, 2009 at 7:15 AM, Mark Murphy <mmur...@commonsware.com> wrote:
> axel wrote:
>> Back to the original question: Apps working well with 1.5/1.6 are
>> broken with 2.0 - exactly the same problem I have.
>> AFAIK the code below is perfectly valid and should continue to work
>> with 2.0 - unfortunately it does not.
>>
>> String[] returnColumns = new String[] {
>>                 Contacts.ContactMethods.PERSON_ID,
>>                 Contacts.ContactMethods.DISPLAY_NAME,
>>                 Contacts.ContactMethods.KIND,
>>                 Contacts.ContactMethods.DATA,
>>                 Contacts.ContactMethods.TYPE
>>                 };
>>
>> Cursor cursor = activity.managedQuery
>> (Contacts.ContactMethods.CONTENT_URI, returnColumns, null, null,
>> Contacts.ContactMethods.DISPLAY_NAME + " ASC");
>>
>> In 2.0 AVD I always get 0 for cursor.getCount() - in 1.5/1.6 AVD this
>> works well. Of course I have created contacts in the AVD before.
>> If I click on "accounts" in the options menu of the Contacts
>> application if causes a "force close" (doesn't look pretty mature to
>> me).
>> The sad thing is that I have an application on the market and receive
>> complains about "force close" errors when contacts are accessed but
>> I'm unable to reproduce it with AVD.
>
> You will need to use reflection (or intelligent class loading) and use
> the ContactsContracts provider when running on Android 2.0, allowing
> your existing Contacts code to be used on 1.5/1.6.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://twitter.com/commonsguy
>
> Android Development Wiki: http://wiki.andmob.org
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to