How to support multiple android version in your code?

前端 未结 8 628
名媛妹妹
名媛妹妹 2020-12-01 11:01

Take accessing contacts in android android.jar for versions 1.6 has People.CONTENT_URI for invoking contacts related info whereas in later versions we need to have api suppo

8条回答
  •  粉色の甜心
    2020-12-01 11:20

    Best practice (though not for Android, but for J2ME) to my knowledge is to use preprocessing C/C++ styled statements, like:

    //#if S40
        ...
    //#else
        ...
    //#endif
    

    Some IDE's support these kind of preprocessing, e.g. Netbeans. To my knowledge Eclipse has some plugins to enable preprocessing also. I don't really know are they applicable to Android development. Try to google yourself.

提交回复
热议问题