ビットマップを効率的に表示するためのアンドロイド開発者チュートリアルに従っており、ビットマップの寸法とタイプを読み取ろうとしています。
これは、ビットマップを読み取るためのコードです。
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
image = BitmapFactory.decodeResource(context.getResources(), R.id.myimage, options);
imageHeight = options.outHeight;
imageWidth = options.outWidth;
imageType = options.outMimeType;
imageHeight、imageWidth の結果はどちらも 0 のようで、imageType は null です。
画像はビットマップ形式です。
私の onCreate メソッドは
ImageView imgView = (ImageView) findViewById(R.id.myimage);
Drawable draw = getResources().getDrawable(R.drawable.bmp_login_screen);
imgView.setImageDrawable(draw);
TextView textView = (TextView) findViewById(R.id.text_view);
ReadBitmapDimen dimensions = new ReadBitmapDimen(getApplicationContext());
textView.setText(" Dimensions for userlogin image: outHeight = " + String.valueOf(dimensions.imageHeight));
ありがとう!