TelephonyManager telmgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String deviceID = telmgr.getDeviceId();
boolean isEmulator = "000000000000000".equalsIgnoreCase(deviceID);
if (isEmulator) {
((myApp) getApplication()).setBitmapX(BitmapFactory.decodeFile(imageFileName));
} else {
((myApp) getApplication()).setBitmapX(BitmapFactory.decodeByteArray((byte[]) args[0], 0, ((byte[])args[0]).length));
}
判断真机还是模拟器
最新推荐文章于 2025-02-12 01:07:02 发布
本文介绍了一种方法,用于检测应用程序是否运行在模拟器上,并根据检测结果使用不同的方式来加载图片资源。
2303

被折叠的 条评论
为什么被折叠?



