我用下面的代碼來放大圖像
int imageId = (Integer)
intent.getExtras().get(ProfilePageNormalUser.class.getName());
imageView = (ImageView)findViewById(R.id.imageviewEnlarged);
System.out.println("*********"+imageId);
InputStream is = this.getResources().openRawResource(imageId);
Bitmap originalBitmap = BitmapFactory.decodeStream(is);
Matrix imageMatrix = new Matrix(); imageMatrix.postRotate(90);
Bitmap scaledBitmap = Bitmap.createBitmap(originalBitmap, imageView.getWidth(), imageView.getHeight(), originalBitmap.getWidth(), originalBitmap.getHeight(), imageMatrix, false);
imageView.setImageBitmap(scaledBitmap);
卻獲得異常: Resources$NotFoundException: Resource ID #0x4
什麼原因造成的呢?
InputStream is = this.getResources().openRawResource(imageId);
這兒的imageId對嗎?應該是raw下沒有這個資源吧。