Вопрос снят. Решение нашлось:
procedure TForm1.Button1Click(Sender: TObject);
begin
CallInUIThreadAndWaitFinishing(
procedure
function BitmapToJBitmap(const ABitmap: TBitmap): JBitmap;
var LSurface: TBitmapSurface;
begin
Result := TJBitmap.JavaClass.createBitmap(ABitmap.Width, ABitmap.Height, TJBitmap_Config.JavaClass.ARGB_8888);
LSurface := TBitmapSurface.Create;
try
LSurface.Assign(ABitmap);
SurfaceToJBitmap(LSurface, Result);
finally
LSurface.Free;
end;
end;
var AStream: TMemoryStream;
ABitmap: TBitmap;
FImage: JImageView;
Container: JRelativeLayout;
LP: JRelativeLayout_LayoutParams;
begin
AStream := TMemoryStream.Create;
ABitmap := TBitmap.Create;
try
with THTTPClient.Create do begin
Get('URL до картинки', AStream);
AStream.Position := 0;
ABitmap.LoadFromStream(AStream);
Free;
end;
FImage := TJImageView.JavaClass.init(TAndroidHelper.Activity);
FImage.setLayoutParams(LP);
FImage.setImageBitmap(BitmapToJBitmap(ABitmap));
Container := TJRelativeLayout.JavaClass.init(TAndroidHelper.Context);
LP := TJRelativeLayout_LayoutParams.JavaClass.init(Round(Width * 1), Round(Height * 1));
LP.addRule(TJRelativeLayout.JavaClass.ALIGN_PARENT_TOP, TJRelativeLayout.JavaClass.TRUE);
LP.addRule(TJRelativeLayout.JavaClass.ALIGN_PARENT_BOTTOM, TJRelativeLayout.JavaClass.TRUE);
LP.addRule(TJRelativeLayout.JavaClass.ALIGN_PARENT_LEFT, TJRelativeLayout.JavaClass.TRUE);
LP.addRule(TJRelativeLayout.JavaClass.ALIGN_PARENT_RIGHT, TJRelativeLayout.JavaClass.TRUE);
Container.addView(FImage, LP);
MainActivity.setContentView(Container);
finally
AStream.Free;
ABitmap.Free;
end;
end);
end;