Search code examples
androidcompatibility

Android app compatibility with 2.2 and 4.0


My App is coded with 2.2 "SdVersion 8" and when I run it in Ice Cream Sandwich I get the "Contex menu" down in botton right.

I want to take use of the new ICS interface. If I change the App to API-level 14 (Android 4.0) I get the new interface! (On 4.0 phone). BUT the App doesn't seem to start at all on phones with older Android-versions for example 2.2.

If I change minSdkVersion in the "API target 14" to 8 .. I get the old 2.2 interface on 4.0 devices.

So. Is it possible for an App to get the 2.2 interface on a 2.2 device, and 4.0 interface on a 4.0 device?


Solution

  • It is not possible to get the 4.0 interface on a 2.2 device without manually importing all of the resources you need from the Android source into your application and applying them correctly. The reason for this is all Android resources that are used to create the ICS theme are already on the phone. When you reference anything inside of the Android package you are actually referencing the Android version that is installed on a given device.

    This is why for example when you open a dialog on an HTC device it looks different than it will on a Samsung device. Device manufactures usually customize some of these built in Android resources to give there device a special look than all other Androids.

    So if you wanted to get the look of the ICS interface on all devices you could go into the android sdk you have downloaded and look in "pathToSDK/platforms/android-14/data/res". I would not suggest this as you might not get all of the required dependencies or you might have some conflicting styles that make it hard to see things. Also most users are comfortable with the theme they are used to seeing on their device and if there is an app that makes a major change to that it might take the user off guard.

    Edit:

    Sorry for my long winded answer as I think I misunderstood your question. You can get a 4.0 interface on a 4.0 and 2.2 interface on a 2.2 by setting the target sdk to 4.0 but leaving the min sdk on the lower setting. This is a deprecated doc but will explain how to do what you are looking for.