1.Setting the minSdkVersion —— 设置minSdkVersion值
If the use of a new API is integral to the application — perhaps you need to record video using an API introduced in Android 1.5 (API Level 3) — you should add a <android:minSdkVersion> to the application's manifest, to ensure your app won't be installed on
older devices.
2.Using reflection —— 使用反射
3.Using a wrapper class —— 使用包装器
The idea is to create a class that wraps all of the new APIs exposed by a new or existing class. Each method in the wrapper class just calls through to the corresponding real method and returns the same result.
4.Testing is key —— 完备的测试是最关键的
You must test your application on every version of the Android framework that is expected to support it. By definition, the behavior of your application will be different on each. Remember the mantra: if you haven't tried it, it doesn't work.
You can test for backward compatibility by running your application in an emulator that uses an older version of the platform. The Android SDK allows you to do this easily by creating "Android Virtual Devices" with different API levels. Once you create the
AVDs, you can test your application with old and new versions of the system, perhaps running them side-by-side to see the differences. More information about emulator AVDs can be found in Creating and Managing Virtual Devices and from emulator -help-virtual-device.
详情请见:http://developer.android.com/resources/articles/backward-compatibility.html
分享到:
相关推荐
Android自定义SeekBar滑动条
兼容 Android 7.0 的通过拍照或者从相册中选择照片来读取图片并且进行裁剪和输出到指定目录的 Android 工程代码
Android调用摄像头拍照(兼容7.0)Demo,原博客文章https://blog.csdn.net/u010356768/article/details/70808162
该文档来自MDCC 2015中国移动开发者大会。胡凯发表了题为“Android内存优化之5R法则”的主题演讲,欢迎下载!
Android圆形向外扩散颜色渐浅动画
Android5.0新控件CardView的Demo和兼容包,相关博文:http://www.cnblogs.com/tianzhijiexian/p/4067308.html
JavaScript调用Android方法,向Android方法传递json数据。
4.18修改裁剪图片兼容问题 如果资源文件未改动请将 273行改为 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.setDataAndType...
Android 可用的竖版 seekbar,只提供VerticalSeekBar类 Android本身只自带横版的seekbar
android展开通知栏,兼容4.2及以上,相关博文地址http://blog.csdn.net/beiminglei/article/details/8909513
Android 上下滚动条、轮训滚动、广告条,附带源码及apk
《Android框架揭秘》通过对Android系统源代码的分析,主要介绍Android框架的初始化过程及主要组件的工作原理。作者直接分析和整理了Android框架的主要源代码,并详细讲解了理解框架工作原理所需的各种基础知识和构成...
Android 切换前后置摄像头,很精简的例子,相信对学习camera有点帮助,欢迎下载
Android 测试上传头像到服务器, 拍照或者选择文件, 对小米手机进行特殊处理
android 向服务器发送多张图片 服务器端和android端代码,测试发送成功
最近2013-11-29(Nov 29, 2013)更新的Android ZXing 2.3.0 release源码及编译后的core-2.3.0.jar和android-integration-2.3.0.jar打包亲测可用,如大家有兴趣自己编译的话请参考下面的教程。 下面我写的教程修改自...
Android串口通信(Android Studio) serial Port 简单的demo 好久之前整的
源码里面有Bluetooth4_3/BLEDemo/Android_Lightblue.apk三个.前两个是BLE的demo。BLEDemo这个功能较Bluetooth4_3多一些,有兴趣的可以都看下。Android_Lightblue.apk是Android版的lightblue,在进行ble开发的时候用...
为 Android 应用提供一个向下滑动即刷新列表的功能,就两个目标文件。 7、pakerfeldt-android-viewflow 是 Android 平台上一个视图切换的效果库。ViewFlow 相当于 Android UI 部件提供水平滚动的 ViewGroup,使用 ...
其次,Fragment可以向下兼容(通过android官方的Support Package),在2.x平台上没有任何问题。 最重要的是,Fragment实质上是一种可以包含控制代码的视图模块,可以非常方便的进行组合。 两个开源项目的地址: 1....