Search code examples
androidcompatibilityandroid-4.0-ice-cream-sandwichandroid-2.3-gingerbread

Android programming and compatability between different versions


Hello I just had a question about compatibility between the different versions of Android and how it works. I have recently started Android programming and have been developing an app for Ice Cream Sandwich 4.0.2 is the source I am working with. Now halfway to completion of this project I started to wonder if this would work at all with lower versions of Android such as Gingerbread. From what I am guessing I don't think it will work. How can I make this compatible with Gingerbread and still use features that have come with Ice Cream Sandwich, like Action Overflow or whatever that is called and the Holo themes. Do I make 2 versions of my app or is there a certain way that will put the app through conditions to determine what version of Android the phone or tablet is running and go from there? Thank you in advance!


Solution

  • Yes, you can absolutely create a single app that runs on many versions of Android. As you might imagine, you have to write most of your code to the oldest version of Android that you want to support. Any features you want to use from newer versions will have to be more carefully thought out. For some features, you may choose to support them only on the newer versions of the OS (e.g. when they really only make sense or are really only possible with the latest hardware). For other features, you will want to look into ways to replicate the behavior you need on older platforms (e.g. ActionBar, Fragments, Animators).

    There are lots of resources available for helping with backward compatibility. In particular, you probably want to take a look at these:

    1. Support Library
    2. ActionBarSherlock
    3. NineOldAndroids