I am capturing an image, storing the data (byte array) in a 2d byte array (the user can take up to five images for this task). After each capture I am displaying it in a web view. Even though I take the pic in portrait mode, it loads in the web view in landscape is there anyway to alter this or prevent it from happening?
I have included android:orientation..etc
//Setting Zoom Controls on Web View
WebPreview.getSettings().setBuiltInZoomControls(true);
WebPreview.getSettings().setDisplayZoomControls(false);
WebPreview.getSettings().setLoadWithOverviewMode(true);
WebPreview.getSettings().setUseWideViewPort(true);
WebPreview.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
imageData = PhotoHandler.ImageByteArray[pHandler.counter];
openJpeg(WebPreview, imageData);
private static void openJpeg(WebView web, byte[] image)
{
String b64Image = Base64.encodeToString(image, Base64.DEFAULT);
String html = String.format(HTML_FORMAT, b64Image);
web.loadData(html, "text/html", "utf-8");
}
I'm really unsure what to do and I can't seem to find anything about rotating webview content..
Any guidance is appreciated.
Thanks
For anyone who might have the same problem I have figured out the rotation problem
I converted the byte array to a bitmap, rotated and then converted back to byte array...
Bitmap test = BitmapFactory.decodeByteArray(IMdata, 0, IMdata.length);
//Getting Width and Height of Bitmap
int width = test.getWidth();
int height = test.getHeight();
Matrix rotMatrix = new Matrix();
//Rotating Bitmap * 90 deg
rotMatrix.postRotate(90);
//Recreating new Bitmap After Rotation
Bitmap testRot = Bitmap.createBitmap(receipt, 0,0,width, height, rotMatrix, true);
I then converted it back
testRot.compress(Bitmap.CompressFormat.JPEG, 60, stream);
byte [] testArray = stream.toByteArray();
EDIT I will post the issue about the camera seperately