Android:how to find the android version name programmatically?

You can try following function.

public String AndroidOSName() {
    String os = Build.VERSION.SDK;
    System.out.println("here is my os" + " " + os);
    if (os.equals("23")) {
        return "Marshmallow";
    } else if (os.equals("21")) {
        return "Lollipop";
    } else if (os.equals("22")) {
        return "LOLLIPOP_MR1";
    } else if (os.equals("20")) {
        return "KitKat";
    } else if (os.equals("19")) {
        return "KitKat";
    } else if (os.equals("18")) {
        return "Jelly Bean";
    } else if (os.equals("17")) {

        return "Jelly Bean";
    } else if (os.equals("16")) {
        return "Jelly Bean";
    } else if (os.equals("15")) {
        return "Ice Cream Sandwich";
    } else if (os.equals("14")) {
        return "Ice Cream Sandwich";
    } else if (os.equals("13")) {
        return "Honeycomb";
    } else if (os.equals("12")) {
        return "Honeycomb";
    } else if (os.equals("11")) {
        return "Honeycomb";
    } else if (os.equals("10")) {
        return "Gingerbread";
    } else if (os.equals("9")) {
        return "Froyo";
    } else if (os.equals("8")) {
        return "Froyo";
    } else {
        return "Not Found";
    }

}