MikeZ87 1 Posted October 8, 2022 Greetings, I have a TMapView component on my firemonkey (android) form. It gets the map image nicely, and I can scroll, zoom in, etc... I need to be able to save that mapview image to storage on an android app, and I'm having no luck. I can't even copy it to another TImage component. Can anyone help me with this? - How can I save the mapview image to local storage on the android? - How can I copy the mapview image to another image component? I've tried things like image1.assign(mapview1.MakeScreenShot) to copy, and MapView1.MakeScreenShot.SaveToFile(filename), but neither of those work. (Assign doesn't do anything, and SaveTo results in an error. Any help would be appreciated. Thanks! Share this post Link to post
Dave Nottage 557 Posted October 8, 2022 1 hour ago, MikeZ87 said: I've tried things like image1.assign(mapview1.MakeScreenShot) to copy, and MapView1.MakeScreenShot.SaveToFile(filename), but neither of those work. (Assign doesn't do anything, and SaveTo results in an error. You need to use the Snapshot method: https://docwiki.embarcadero.com/Libraries/Alexandria/en/FMX.Maps.TCustomMapView.Snapshot 1 Share this post Link to post
MikeZ87 1 Posted October 8, 2022 Thanks for the lead, Dave. I'm not really sure how to use that, and googling for help on it (with examples) doesn't yield any code. Could you give me an example? Share this post Link to post
Dave Nottage 557 Posted October 8, 2022 46 minutes ago, MikeZ87 said: I'm not really sure how to use that I'm not sure what is unclear about it. The method takes a single parameter that is an object method with a single parameter that is a TBitmap: https://docwiki.embarcadero.com/Libraries/Alexandria/en/FMX.Maps.TMapScreenshotRecipient i.e. you would declare a method on an object (such as the form that contains the MapView), and pass that when calling Snapshot, e.g: procedure TForm1.SnapshotRecipient(const ABitmap: TBitmap); begin // Do whatever you will with ABitmap, here end; ..and call Snapshot like this, for example: MapView1.Snapshot(SnapshotRecipient) 1 Share this post Link to post
MikeZ87 1 Posted October 8, 2022 Hi Dave, OMG!!! THAT WORKED!!! You're my HERO!!! THANK YOU!!! I'm learning more and more Delphi every day, and **THIS** is huge! THANK YOU!!! 1 Share this post Link to post