With the following code shows a preview of the camera vertically and it\'s works.. BUT!! I get a photo in landscape! :(
How I can build it vertically? I\'ve the prev
It is the solution I implemented. It works perfectly. I hope that helps.
PictureCallback myPictureCallback_JPG = new PictureCallback() {
@Override
public void onPictureTaken(byte[] arg0, Camera arg1) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 6;
options.inDither = false; // Disable Dithering mode
options.inPurgeable = true; // Tell to gc that whether it needs free
// memory, the Bitmap can be cleared
options.inInputShareable = true; // Which kind of reference will be
// used to recover the Bitmap
// data after being clear, when
// it will be used in the future
options.inTempStorage = new byte[32 * 1024];
options.inPreferredConfig = Bitmap.Config.RGB_565;
bMap = BitmapFactory.decodeByteArray(arg0, 0, arg0.length, options);
// others devices
if(bMap.getHeight() < bMap.getWidth()){
orientation = 90;
} else {
orientation = 0;
}
Bitmap bMapRotate;
if (orientation != 0) {
Matrix matrix = new Matrix();
matrix.postRotate(orientation);
bMapRotate = Bitmap.createBitmap(bMap, 0, 0, bMap.getWidth(),
bMap.getHeight(), matrix, true);
} else
bMapRotate = Bitmap.createScaledBitmap(bMap, bMap.getWidth(),
bMap.getHeight(), true);
FileOutputStream out;
try {
out = new FileOutputStream(
String.format("/sdcard/DCIM/test/screen.jpg"));
bMapRotate.compress(Bitmap.CompressFormat.JPEG, 90, out);
if (bMapRotate != null) {
bMapRotate.recycle();
bMapRotate = null;
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
camera.startPreview();
MostrarFoto(imageInSD);
editor = prefs.edit();
editor.putString("PathSeleccio", imageInSD);
editor.commit();
}
};