我需要放大图像,我使用了下面的代码
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谁能告诉我问题出在哪里。谢谢
发布于 2011-11-01 19:31:20
我认为应该使用this.getResources().openRawResource(id)。您必须将您的资源移动到res/raw文件夹。
尝试在res文件夹下创建一个名为raw的文件夹,并将您的资源粘贴到那里。
让我知道它进行得怎么样..
发布于 2011-11-01 18:57:20
OpenRawResource无法从您正在使用的imageId中找到资源。
检查你的imageId。
你可以直接使用:我认为:InputStream ins = getResources().openRawResource(R.raw.my_db_file);
指定raw文件夹中如上所述的imageId。
首先像这样检查,它工作或不工作。
https://stackoverflow.com/questions/7965399
复制相似问题