Search code examples
delphifiremonkey

Delphi android cannot use TPath


I need to store a picture taken from the camera and I am trying to use the code you can find below.

ImagePhoto.Bitmap.SaveToFile(  TPath.Combine(TPath.GetCameraPath, getNewName) );

In particular the variables names stands for:

  • ImagePhoto: a TImage containing the taken picture
  • getNewName: a function that returns a string like filename.bmp

I have included System.IOUtils in the uses clauses but the TPath doesn't work properly. When I press Ctrl and I click on TPath the IDE opens this

TPath = class(TCustomPath)

and that's inside the FMX.Objects, not it System.IOUtils! How can I fix this? I am using Delphi Tokyo.

Basically I need to know how to specify that I need the TPath from IOUtils.


Solution

  • Seems that FMX.Objects appears after System.IOUtils in the uses clause. Either change that or qualify the call to TPath:

    ImagePhoto.Bitmap.SaveToFile(System.IOUtils.TPath.Combine(System.IOUtils.TPath.GetCameraPath, getNewName));