patbenatar wrote:
> Mark- on a side note, how does one go about writing conditional code
> for different versions of android? Thanks!

Reflection or conditional class loading are the two prevalent techniques.

Here is a sample of conditional class loading to use different versions
of the contacts content provider:

http://github.com/commonsguy/cw-advandroid/tree/master/Contacts/Spinners/

Here is a sample (two projects, "before" and "after") of using
reflection to handle API versions:

http://github.com/commonsguy/cw-android/tree/master/APIVersions/

In the case of onBackPressed(), that just won't get called on earlier
versions of Android. But, you can consolidate the setResult/finish logic
in a common private method called from either onBackPressed() or
onKeyDown() (in the case of a KeyEvent.KEYCODE_BACK).

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Training in US: 14-18 June 2010: http://bignerdranch.com

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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to