0

I have retrieved the android version by String androidVersion = Build.VERSION.RELEASE

Now i want that if my version is 4.0 i should get IceCreamSandwich instead of 4.0 in a string variable at runtime.Please help if there is any API for codename. Thanks in advance. My sample code is:

     String androidVersion = Build.VERSION.RELEASE.toString();
     String androidName = "";
     String and = "4.1.2";
        if(androidVersion == and)
        {
        androidName = "JellyBeans";
        }
    else
    {
        androidName = "Not Having any name";

    }

On debugging i m unable to enter the if loop and it is going in else. I don't Know what is the issue. May be the version i m getting and string i m passing to compare are not matching. Thanks in advance.

4

2 に答える 2