简体   繁体   English

Delphi XE7位图大小转换为Android上的大消息

[英]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. 当我在Android手机上拍照时,我的XE7应用程序崩溃了,并且显示位图尺寸很大。 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. 它来自embarcadero的示例,它涉及在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. 还尝试调试操作,并在调试过程中重复执行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. 我的表单具有ScaleBy属性,这就是问题所在。 After renaming the property I didn't have the issue anymore. 重命名属性后,我再也没有问题了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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