Community,
my problem is the following:
I have written a XE7 FMX application for my Kindle Fire where I want to work with TBitmaps. The problem is, I'm unable to create a TBitmap from the storage of my device. If I run the application as a Win32-app on my computer all works, but if I run it as an android-app, it throws the exception from the title.
Here is my code:
procedure TForm1.Button1Click(Sender: TObject);
var
MyImage: TBitmap;
Path: String;
begin
Path := TPath.GetDocumentsPath + TPath.DirectorySeparatorChar + 'test.png';
if TFile.Exists(path, true) then
begin
MyImage := TBitmap.CreateFromFile(path); //<- Here it fails
end;
end;
This code has no sense but this is only a test program. If this works I can use it in my main program but it already fails at this point. (And I have already checked that he used the FMX.Graphics.TBitmap and not the VCL)
Here is my stack:
System._DbgExcNotify(86,0x11fc0b0,0x5bf3b0dd,0x11fc0b0,0x5bf3b0dd)
System.NotifyReRaise(0x11fc0b0,0x5bf3b0dd)
System._RaiseAtExcept(0x11fc0b0,0x5bf3b0dd)
System._RaiseExcept(0x11fc0b0)
System.Internal.Excutils.DoRaiseJNIExceptionCallBack('class java.lang.OutOfMemoryError','java.lang.OutOfMemoryError')
Androidapi.Jni.HandleJNIException(0xbe42f8)
Androidapi.Jnimarshal.ExecJNI(0x5d226490,0x125e998)
:5C8B8A14 DispatchToImport
:5C8C4FA8 dispatch_first_stage_intercept
Fmx.Graphics.Android.TBitmapCodecAndroid.LoadFromFile(0x127e7f8,'/data/data/com.embarcadero.Project1/files/test.png',0x1297040,4096)
Fmx.Graphics.TBitmapCodecManager.LoadFromFile(0x5cbab65c,'/data/data/com.embarcadero.Project1/files/test.png',0x1297040,4096)
Fmx.Graphics.TBitmap.LoadFromFile(0x127e788,'/data/data/com.embarcadero.Project1/files/test.png')
Fmx.Graphics.TBitmap.TBitmap(0x127e788,1,'/data/data/com.embarcadero.Project1/files/test.png')
Unit1.TForm1.Button1Click(0xad1c48,0x103dbd8)
[...] rest is unneccessary
Where is the error? Is it my fault or did delphi something wrong?