Android examples for Hardware:CPU Information
Check if the CPU architecture is x86
//package com.java2s; import android.util.Log; import java.lang.reflect.Method; public class Main { private static boolean LOGENABLE = false; /**//from ww w.ja va2 s. co m * Check if the CPU architecture is x86 */ public static boolean checkIfCPUx86() { //1. Check CPU architecture: arm or x86 if (getSystemProperty("ro.product.cpu.abi", "arm").contains("x86")) { //The CPU is x86 return true; } else { return false; } } private static String getSystemProperty(String key, String defaultValue) { String value = defaultValue; try { Class<?> clazz = Class.forName("android.os.SystemProperties"); Method get = clazz.getMethod("get", String.class, String.class); value = (String) (get.invoke(clazz, key, "")); } catch (Exception e) { if (LOGENABLE) { Log.d("getSystemProperty", "key = " + key + ", error = " + e.getMessage()); } } if (LOGENABLE) { Log.d("getSystemProperty", key + " = " + value); } return value; } }