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