私はカメラショットからビットマップを変更するメソッドを書きました:
public Bitmap bitmapChange(Bitmap bm) {
/* get original image size */
int w = bm.getWidth();
int h = bm.getHeight();
/* check the image's orientation */
float scale = w / h;
if(scale < 1) {
/* if the orientation is portrait then scaled and show on the screen*/
float scaleWidth = (float) 90 / (float) w;
float scaleHeight = (float) 130 / (float) h;
Matrix mtx = new Matrix();
mtx.postScale(scaleWidth, scaleHeight);
Bitmap rotatedBMP = Bitmap.createBitmap(bm, 0, 0, w, h, mtx, true);
return rotatedBMP;
} else {
/* if the orientation is landscape then rotate 90 */
float scaleWidth = (float) 130 / (float) w;
float scaleHeight = (float) 90 / (float) h;
Matrix mtx = new Matrix();
mtx.postScale(scaleWidth, scaleHeight);
mtx.postRotate(90);
Bitmap rotatedBMP = Bitmap.createBitmap(bm, 0, 0, w, h, mtx, true);
return rotatedBMP;
}
}
別のAndroidデバイス、Galaxy Nexusでも正常に動作しますが、Samsung Galaxy S3では、拡大縮小された画像が画面に表示されません。
メソッドにマークを付けてbitmapChange
、元のサイズのビットマップを画面に表示させようとしましたが、S3も画面に何も表示されません。
Eclipseの変数の情報はここにあります。ソニーのxperiaの情報はこちらです。
xperiaやその他のデバイスは正常に動作しています。
編集:
LogCatで奇妙なログを取得しました。
写真を撮ると、LogCatに次のメッセージが表示されます。
私はビデオを決して使いません...
なぜビデオが始まるのですか?