I cam creating an app for Android with Delphi XE 10.3, Firemonkey. I have tried every possible idea and searched online for days but can't find a solution. I have many PNG images loaded as assets (RT_RCDATA).
var InStream: TResourceStream;
begin
InStream := TResourceStream.Create(HInstance,'PngImage_'+inttostr(trunc(TrackBar2.Value)), RT_RCDATA);
try
Image1.Bitmap.LoadFromStream(InStream);
finally
InStream.Free;
end;
end;
Then every time I click on the button, the image is shown correctly.
But what does not work, (and what I should be able to do) is:
procedure TForm1.Timer1Timer(Sender: TObject);
var InStream: TResourceStream;
begin
InStream := TResourceStream.Create(HInstance, 'PngImage_'+inttostr(imgcount), RT_RCDATA);
label5.Text:='PngImage_'+inttostr(layerCount);
try
Image1.Bitmap.LoadFromStream(InStream);
finally
InStream.Free;
end;
imgcount:=imgcount+1;
//FOrce refresh
//image1.Repaint; // this seems to do nothing
//image1.Visible:=false; image1.Visible:=true; // this also does nothing to help
//application.processmessages; // neither this one
end
If I try to load and show a sequence of images,with some delay between them, (like an automatic slideshow), then the image is not updated; if I try to show images1-2-3-4, onyly image 4 is shown. I have tried everything, from repaint, refresh methods, hide/show visibility, calling application.processmessages, loading a bitmap and drawing it to form canvas, using a timer, but I can't find a solution.
Thanks