I have several small .PNG pictures I wan't to load from a web-address and into TImage images in my application. The pictures are "dynamic", so I don't want to "hardcode" them into my app by using TImageList etc.
I have seen several examples, but none of them can give me a straight way to do this.
I know I can use TWebBrowser to solve this, but it seems to obscure my application and is not aligned to the alignment i set it to either.
Any good suggestions ?
My platform is Android, I am using Embarcadero C++Builder XE8 / Appmethod 1.17
In FireMonkey, the
FMX.Graphics.TBitmapclass handles multiple image formats, including PNG. TheFMX.Objects.TImagecomponent has aBitmapproperty. All you have to do is use Indy'sTIdHTTPcomponent (or any other HTTP API/library of your choosing) to download the PNG image data into aTMemoryStream, and then you can call theTImage::Bitmap::LoadFromStream()method to load the stream data for display, for example:Since downloading from a remote server can take time, and you should never block the UI thread, you should use a worker thread to handle the download, for example: