简体   繁体   中英

Delphi XE7 Bitmap size to big message on Android

When I take a picture on my Android phone my XE7 app crashes and it says Bitmap size to big. But I use code i've used before and it worked fine. It's from the example of embarcadero about taking pictures on android/iOS.

My code below:

procedure TForm1.TakePhotoFromCameraAction1DidFinishTaking(
  Image: TBitmap);
var
  saveParams:TBitmapCodecSaveParams;
  directory,name:String;
begin
  image1.Bitmap.Assign(Image);
  saveParams.Quality := 100;
  {$IFDEF ANDROID}
  directory := TPath.GetPicturesPath;
  name := '/RoomId:'+ fRoomId.ToString()+' '+DateTimeToStr(Now)+'.png';
  {$ENDIF}
  {$IFDEF IOS}
  directory := TPath.GetDocumentsPath;
  name := '/RoomId:'+ fRoomId.ToString()+' '+DateTimeToStr(Now)+'.png';
  {$ENDIF}
  Image.SaveToFile(directory+name,@saveParams);
end;

Anyone know why it doesn't work?

UPDATE: I know for sure that the code is correct. I've tested it in a different app. Also tried to debug the action and during debug It kept on repeating TTakePhotoFromCameraAction.CustomTextChanged. Also during debug it did save the picture but it couldn't close the action correctly for some reason. Strange thing is that the code also works for a samsung tablet but not for a sony phone.

I had a ScaleBy property for the form and this was the problem. After renaming the property I didn't have the issue anymore.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM