[Solved] Background Image lazarus / 43-Android ---------------------------------------------------------------------- higgins · 2023-02-16 14:36 Hi there, I try to set a background image using  jImageView on which i set layoutParamHeight and layoutParamWidth properties to lpMatchParent but, i encounter issues Method #1: using jImageList I add my picture to the jImagelist and set  ImageList and  Imageindex properties of the JImageView component: it works fine My problem is that i need a second jImageList to store icons for buttons  (all pictures in an jImageList need to have the same size) and there is the issue: whatever jImageList i handle, the pictures are  "mixed" between the two jImagelist components, with different sizes and, so, cannot be accessed by the  Imageindex property. every change on one jImagelist component affects the other too  How can i use more than one jImagelist in the application? So, I tried method #2: using resources I added to the project'sresources a bitmap file named background.bmp , I named the resource BACKGROUND and i added the following code to the onCreate Event Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TAndroidModule1.AndroidModule1Create(Sender: TObject);   var bmp:jBitmap;begin   bmp:=jBitmap.create(self);   bmp.LoadFromRes('BACKGROUND');   imageview1.SetImageBitmap(bmp); end; Issue: The picture is not loaded could anyone help me please? ---------------------------------------------------------------------- jmpessoa · 2023-02-20 21:15 Hi, higgins! Get a  jBitmap component from component tabs [Android Bridge] No "create" is need... just use it! ---------------------------------------------------------------------- higgins · 2023-02-22 08:38 Hi, Thank you for your help. I don't really understand why using a jBitmap from the tab may have a different behaviour than creating it by code. Indeed, the result is the same for me, the form remains blank on my phone. This is my code Project: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {hint: Pascal files location: ...\AppLAMWProject16\jni }library controls;  //[by LAMW: Lazarus Android Module Wizard: 22/02/2023 08:38:16]  {$mode delphi}  uses  {$IFDEF UNIX}{$IFDEF UseCThreads}  cthreads,  {$ENDIF}{$ENDIF}  Classes, SysUtils, And_jni, And_jni_Bridge, AndroidWidget, Laz_And_Controls,  Laz_And_Controls_Events, unit1;  {%region /fold 'LAMW generated code'}     {$R *.res} begin  gApp:= jApp.Create(nil);  gApp.Title:= 'LAMW JNI Android Bridges Library';  gjAppName:= 'org.lamw.applamwproject16';  gjClassName:= 'org/lamw/applamwproject16/Controls';  gApp.AppName:=gjAppName;  gApp.ClassName:=gjClassName;  gApp.Initialize;  gApp.CreateForm(TAndroidModule1, AndroidModule1);end.                 AndroidModule: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses  {$IFDEF UNIX}{$IFDEF UseCThreads}  cthreads,  {$ENDIF}{$ENDIF}  Classes, SysUtils, AndroidWidget, Laz_And_Controls;  type   { TAndroidModule1 }   TAndroidModule1 = class(jForm)    Bitmap1: jBitmap;    ImageView1: jImageView;    procedure AndroidModule1Create(Sender: TObject);  private    {private declarations}  public    {public declarations}  end; var  AndroidModule1: TAndroidModule1; implementation  {$R *.lfm}   { TAndroidModule1 } procedure TAndroidModule1.AndroidModule1Create(Sender: TObject);begin   Bitmap1.LoadFromRes('BACKGROUND');   imageview1.SetImageBitmap(Bitmap1);end; end.             Regarding the jIMageList, issue, do you have a clue? When searching through the forum to find informations about that, i found a topic posted in march 2021 about this https://forum.lazarus.freepascal.org/index.php/topic,53684.msg397892.h tml#msg397892 any informations about that? ---------------------------------------------------------------------- jmpessoa · 2023-02-24 22:59 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i imageview1.SetImageBitmap(Bitmap1);       // No!  use as: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i imageview1.SetImageBitmap(Bitmap1.GetImage());       // Yes! ---------------------------------------------------------------------- higgins · 2023-02-27 10:41 Thanks for you help. Actually, i noticed that the resource i added in project's options doesn't exist in the application a call to "Findresource(hinstance,'BACKGROUND','BITMAP') returns 0 Do i need to set additional options to include the resource in the application? ---------------------------------------------------------------------- jmpessoa · 2023-02-28 17:32 Put your image in project folder  ..../res/drawable ---------------------------------------------------------------------- higgins · 2023-03-02 09:54 Indeed, this doesn't work much more  I also tried to copy the file in ../assets to use "Bitmap1.loadfromfilename('background.bmp')" or "Bitmap1.loadfromassets('background.bmp') without success At last it works with copying the picture in ..../res/drawable as you suggested then in Android module, set backgroundimageidentifier property to 'background"