Java tutorial
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import android.util.Log; public class Main { public static String getModel() { String strModel = getBuildString(); if (strModel != null && strModel.split("-").length == 4) { return strModel.split("-")[3]; } return ""; } public static String getBuildString() { String strValue = null; BufferedReader birReader = null; try { Process p = Runtime.getRuntime().exec("getprop ro.modversion"); birReader = new BufferedReader(new InputStreamReader(p.getInputStream()), 1024); strValue = birReader.readLine(); birReader.close(); } catch (IOException e) { Log.e("HelperFunctions", "Unable to read property", e); } finally { if (birReader != null) { try { birReader.close(); } catch (IOException e) { Log.e("HelperFunctions", "Exception while closing the file", e); } } } return strValue; } }