0
我对此代码有问题。我想从路径加载图像到imageview。当使用此代码一切正常BitmapFactory.decodeFile仅在手机中返回null,不在仿真器中
image.setImageBitmap(BitmapFactory.decodeFile(imagePath));
但是当我用这一个,在模拟器是好的,但应用程序停止在电话工作,让我的错误,无效的位图
Bitmap bitmap = BitmapFactory.decodeFile(imagePath);
image.setImageBitmap(bitmap);
我需要这段代码。
Matrix mat = new Matrix();
mat.postRotate(90);
bitmap = BitmapFactory.decodeFile(imagePath);
bitmap_final = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), mat, true);
image.setImageBitmap(bitmap_final);
再次,在模拟器,一切都很好,在手机没有:/感谢您的帮助和抱歉不好英语
也许'imagePath'在仿真器上有效,但不在设备上,路径是什么?你是否也在说使用* same *方法调用,而是分配给一个变量失败? – 2013-02-15 23:36:25