Android backward compatibility techniques

吃可爱长大的小学妹 提交于 2019-12-05 19:03:12

You can check the API level in android at runtime and enable the required features as per the API level.

Something like below.

int currentapiVersion = android.os.Build.VERSION.SDK_INT;
if (currentapiVersion >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH){
// Do something for ICS and above versions
} else{
// do something for phones running an SDK before ICS
}

Additionally you can add the version qualifier to the resource folder such as drawable-v15 (will pickup drawables if the device API level is 15)

Check this LINK for more information on how to specify the required qualifiers for the resources

with this the latest functionality available will be enabled when launched on latest firmware devices and backward compatibility is enabled otherwise.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!