String phoneInfo = "Product: " + android.os.Build.PRODUCT;
phoneInfo += ", CPU_ABI: " +android.os.Build.CPU_ABI;
phoneInfo += ", TAGS: " +android.os.Build.TAGS;
phoneInfo += ", VERSION_CODES.BASE: " + android.os.Build.VERSION_CODES.BASE;
phoneInfo += ", MODEL: " +android.os.Build.MODEL;
phoneInfo += ", SDK: " +android.os.Build.VERSION.SDK;
phoneInfo += ", VERSION.RELEASE: " + android.os.Build.VERSION.RELEASE;
phoneInfo += ", DEVICE: " +android.os.Build.DEVICE;
phoneInfo += ", DISPLAY: " +android.os.Build.DISPLAY;
phoneInfo += ", BRAND: " +android.os.Build.BRAND;
phoneInfo += ", BOARD: " + android.os.Build.BOARD;
phoneInfo += ", FINGERPRINT: " +android.os.Build.FINGERPRINT;
phoneInfo += ", ID: " +android.os.Build.ID;
phoneInfo += ", MANUFACTURER: " +android.os.Build.MANUFACTURER;
phoneInfo += ", USER: " + android.os.Build.USER;
Product: soju,
CPU_ABI: armeabi-v7a,
TAGS: release-keys,
VERSION_CODES.BASE: 1,
MODEL: Nexus S,
SDK: 10,
VERSION.RELEASE: 2.3.6,
DEVICE: crespo,
DISPLAY: GRK39F,
BRAND: google,
BOARD: herring,
FINGERPRINT:google/soju/crespo:2.3.6/GRK39F/189904:user/release-keys,
ID: GRK39F,
MANUFACTURER: samsung,
USER: android-build
DisplayMetrics metric = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metric);
int width = metric.widthPixels; // 屏幕宽度(像素)
int height = metric.heightPixels; // 屏幕高度(像素)
float density = metric.density; // 屏幕密度(0.75 / 1.0 / 1.5)
int densityDpi = metric.densityDpi; // 屏幕密度DPI(120 / 160/ 240)
Toast.makeText(this,
"屏幕宽度 : " + width+" 屏幕高度:"+height+" 屏幕密度:"+density+" 屏幕密度DPI:"+densityDpi,
Toast.LENGTH_LONG).show();