jSpinner functions Clear() and Add() work only in OnCreate event lazarus / 43-Android ---------------------------------------------------------------------- neuro · 2025-11-03 14:32 jSpinner functions Clear() and Add() work only in 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 TAndroidModule1.AndroidModule1Create(Sender: TObject);begin  jSpinner1.Items.Clear(); // <-- works ok  jSpinner1.Items.Add('hello');  // <-- works ok  jSpinner1.Items.Add('world');  // <-- works okend; jSpinner functions Clear() and Add() do not work when App is running: 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.jButton1Click(Sender: TObject);begin  jSpinner1.Items.Clear(); // <-- does not work  jSpinner1.Items.Add('hello');  // <-- does not work  jSpinner1.Items.Add('world');  // <-- does not workend; How to fix this problem? LAWM program code has two files: QuoteC:\fpcupdeluxe\ccr\lamw\android_wizard\smartdesigner\java\jSpinne r.java C:\fpcupdeluxe\ccr\lamw\android_wizard\smartdesigner\java\jSpinner_new .javaWhy there are two files instead of one? ---------------------------------------------------------------------- neuro · 2025-11-04 16:56 I have found out how to fix the problem. You need to use two different program codes for 1) OnCreate event and 2) when app is already running. In OnCreate event the program code should be like this: 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   jSpinner1.Items.Clear(); // <-- works only in OnCreate event, does not work when app is already running  jSpinner1.Items.Add('hello');  // <-- works only in OnCreate event, does not work when app is already running  jSpinner1.Items.Add('world');  // <-- works only in OnCreate event, does not work when app is already running When app is already running the program code should be without word ”Items”: 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   jSpinner1.Clear(); // <-- works only when app is already running, does not work in OnCreate event  jSpinner1.Add('hello');  // <-- works only when app is already running, does not work in OnCreate event  jSpinner1.Add('world');  // <-- works only when app is already running, does not work in OnCreate event The biggest problem with LAMW is that it uses Android components which are very different from standard Lazarus components and when you are porting program code from Windows into Android, the copy/pasted program code fails to work as expected. Another problem with LAMW is that there are no sample projects for huge number of functions of LAMW and you need to spent massive amount of time wondering in the dark without any guidance.