public void OnPictureTaken(byte[] data, Android.Hardware.Camera camera) { // Creates a data access object to record the intrusion in the history DAO = new DataAccessObject(); DAO.insertHistoryItems(DateTime.Now.ToString(), "Intrusion Detected", data); Bitmap bmp; BitmapFactory.Options bmpOptions = new BitmapFactory.Options { InJustDecodeBounds = true }; bmpOptions.InSampleSize = 4; bmpOptions.InJustDecodeBounds = false; //decode the data obtained by the camera into a Bitmap bmp = BitmapFactory.DecodeByteArray(data, 0, data.Length, bmpOptions); int width = bmp.Width; int height = bmp.Height; Matrix matrix = new Matrix(); matrix.PostRotate(270); Bitmap resized = Bitmap.CreateBitmap(bmp, 0, 0, width, height, matrix, false); afile = new Java.IO.File(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "picture.jpeg"); fileWritter = new FileOutputStream(afile); fileWritter.Write(data, 0, data.Length); attach = new Attachment(afile.Path); picturePath = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "picture.jpeg"); }