get Parsed Cpu Abi Info - Android Hardware

Android examples for Hardware:CPU Information

Description

get Parsed Cpu Abi Info

Demo Code


import java.lang.reflect.Field;
import android.os.Build;
import android.text.TextUtils;

public class Main{
    public static final String getParsedCpuAbiInfo() {
        StringBuilder cpuAbiInfo = new StringBuilder();
        String cpuAbi = BuildHelper.get_CPU_ABI();
        if (!TextUtils.isEmpty(cpuAbi)) {
            cpuAbiInfo.append("CPU ABI : ");
            cpuAbiInfo.append(cpuAbi);//from   w w w  .  j  a v  a2  s  . c o  m
            cpuAbiInfo.append("\n");
        }

        String cpuAbi2 = BuildHelper.get_CPU_ABI2();
        if (!TextUtils.isEmpty(cpuAbi)) {
            cpuAbiInfo.append("CPU ABI2 : ");
            cpuAbiInfo.append(cpuAbi2);
            cpuAbiInfo.append("\n");
        }

        return cpuAbiInfo.toString();
    }
    public static final String get_CPU_ABI() {
        return Build.CPU_ABI;
    }
    public static final String get_CPU_ABI2() {
        try {
            Field field = Build.class.getDeclaredField("CPU_ABI2");
            if (field == null)
                return null;

            Object fieldValue = field.get(null);
            if (field == null || !(fieldValue instanceof String)) {
                return null;
            }

            return (String) fieldValue;
        } catch (Exception e) {

        }

        return null;
    }
}

Related Tutorials