Android Utililty Methods Version String Compare

List of utility methods to do Version String Compare

Description

The list of methods to do Version String Compare are organized into topic(s).

Method

intcompareVersion(String versionA, String versionB)
Check sign to see if versionA is major or minor of versionB return 0 indicate a unparsable version string
if (versionA == null || versionB == null)
    return 0;
int ret = 0;
try {
    String[] aA = versionA.split("\\.");
    String[] aB = versionB.split("\\.");
    if (aA.length == 0) {
        aA = new String[] { versionA };
...
intcompareVersion(String appVer, String updateVer)
compare Version
if (appVer.equals(updateVer))
    return 0;
String[] appVerNum = appVer.split("\\.");
String[] updateVerNum = updateVer.split("\\.");
for (int i = 0; i < Math.min(appVerNum.length, updateVerNum.length); ++i) {
    if (Integer.parseInt(appVerNum[i]) > Integer
            .parseInt(updateVerNum[i]))
        return 1;
...