To get a list of the build versions vs. API, check here:
Get Android API level of phone currently running my application
However, it sounds like you really want to get the API / version number of a particular install. That is mentioned in that link under android.os.Build.VERSION
- and if you want to display something meaningful to the user, then use the RELEASE
field or a static String array from the table.
If you really need the "reverse lookup" like your question suggests, then it is not possible without the table. Older versions of Android will not know the release versions or valid API numbers of future versions, of course. In other words, as we are currently on 5.0 and API 21, do you know if there will be API 22 and version 5.0 also? Like version 4.4 has 2 API numbers (19 and 20). Your code will not always run on every device unless you hard-code "future releases" for older devices.