Java tutorial
//package com.java2s; /******************************************************************************* * Created by Carlos Yaconi * Copyright 2012 Fork Ltd. All rights reserved. * License: GPLv3 * Full license at "/LICENSE" ******************************************************************************/ import java.util.StringTokenizer; import android.os.Build; public class Main { public static String getBuildVersionRelease() { String version = ""; try { String release = Build.VERSION.RELEASE; StringTokenizer st = new StringTokenizer(release, "."); boolean first = true; while (st.hasMoreElements()) { String number = st.nextToken(); if (number != null) number = number.substring(0, 1); version = (first) ? number : version + "." + number; first = false; } } catch (Exception e) { } return version; } }