I'd would like to implement multi-touch in my app. Multi touch support wasn't available until API version 5. However, I would also like my app to be backwards compatible until API level 4. Is there a way to get around this, other than creating two separate .apk's in which I remove the multi touch code from the level 4 version?
Asked
Active
Viewed 2,091 times
4
-
See also http://stackoverflow.com/questions/3459032/how-best-to-cope-with-different-versions-of-android and http://stackoverflow.com/questions/2768101/can-i-compile-an-android-app-on-2-1-and-have-support-for-all-versions-1-5-onward – jfritz42 Feb 23 '12 at 17:29
1 Answers
8
The basic way to use features from a specific SDK version, but still remain backwards compatible, is to create an interface describing the methods you need, then implement that interface for the different SDK versions you want to target. At runtime, you instantiate the correct implementation depending on the Android version (Build.VERSION.SDK
).
With respect to multitouch, there was a good article on the Android Developer's Blog about this a few months ago: How to have your Cupcake and eat it too.

Erich Douglass
- 51,744
- 11
- 75
- 60
-
-
Also see: http://developer.android.com/resources/articles/backward-compatibility.html – hackbod Dec 31 '10 at 19:32