[REOPEN] How to add item to jListView in an arbitrary position lazarus / 43-Android ---------------------------------------------------------------------- jluixjurado · 2022-09-13 13:17 Hi! I've just begun with LAMW and it's amazing! One of my first tests has been with jListViews and I'm blocked with this problem: When I try to insert a new item in a certain position, like 0 (the jListView has more than one item), I haven't found any method to do that so, I tried with    jlvList1.Items.Insert(0,'Hello'); Although it doesn't raise any exception, nothing happends !? After that I tried updating the component with jListView1.invalidate, with jListView1Refresh, with jListView1.updateJNI(gApp), with jListView1.UpdateLayout, ... without any luck. Can it be achieved any way without clearing the component and adding all items again? Thanks in advance for your answers. ---------------------------------------------------------------------- rsu333 · 2022-09-13 13:37 I think add(' item') work , As new user  face this type of problem ,is common so we can check this like listview1.(here we get list of command) then test it. (Same with edittext1 ,textview etc) LAMW is very easy to use and learn  yet working perfectly. Thanks LAMW team. ---------------------------------------------------------------------- jluixjurado · 2022-09-13 15:02 But add(item') adds the item at the end of the jListview, and I want to put it in an arbitrary position (the first one, for instance) ---------------------------------------------------------------------- jmpessoa · 2022-09-13 21:43 Quote I want to put it in an arbitrary position.... Done! Now there is a new "Insert" method! Please, update your LAMW from github... Thank You! ---------------------------------------------------------------------- Mongkey · 2022-09-15 06:06 Quote from: jmpessoa on September 13, 2022, 11:43:49 pm Quote I want to put it in an arbitrary position.... Done! Now there is a new "Insert" method! Please, update your LAMW from github... Thank You! does my report bug on smartdesigner insertion plugin already done also? ---------------------------------------------------------------------- jmpessoa · 2022-09-15 06:33 Quotedoes my report bug on smartdesigner insertion plugin already done also? Yes! Thank you! ---------------------------------------------------------------------- Mongkey · 2022-09-15 23:08 thank you very much, on Bluetooth connection also got bugs, very hard to connect, but i got the proper one. i post proper code here, thank you. it is very useful for doing wireless  thermal printing for receipt. But by the way what are the advantages of using kotlin on LAMW? ---------------------------------------------------------------------- jluixjurado · 2022-09-16 13:59 Thank you very much! Such an incredible piece of work! ---------------------------------------------------------------------- jluixjurado · 2022-10-01 18:10 Hello! @jmpessoa , I think there could be something wrong with the new Inserrt method you added some days ago to jListView. In fact, the method works as expected and adds a new item in the specified position but ... it seems that then you cannot use jListview.delete method properly! The item is not deleted at all! For example, if you put 3 jButtons (Button1, Button2 and Button3) and a jListView (ListView1) in an empty module (AndroidModule1) and add the next code: 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.Button1Click(Sender: TObject);begin  ListView1.Add('Added '+intToStr(ListView1.count));end; procedure TAndroidModule1.Button2Click(Sender: TObject);begin  ListView1.delete(0);end; procedure TAndroidModule1.Button3Click(Sender: TObject);begin  ListView1.Insert(0,'Inserted in 0');end; and runs it: if you Adds, lets say,three items with Button1, then you can delete the three pressing Button2 If you now Insert, lets say, three items with Button3, then you CAN'T delete any one pressing Button2 If you reopen the app and Add 3 items with Button1 and then Insert other three items with Button3 (or viceversa or in any other order) then you can ONLY delete the three first items. It looks like when inserting items the control doesn't increase the count of them so, even having 6 items (for example), it's only capable of deleting three of them. Am I right or am I doing something wrong? Thanks in advance. ---------------------------------------------------------------------- jmpessoa · 2022-10-08 16:23 QuoteAm I right or am I doing something wrong? Well, I think that you are  correct ..  I'll try to understand what's going on... ---------------------------------------------------------------------- jluixjurado · 2022-10-12 08:57 Thank you very much. If you think any help, don't hesitate to ask me for it!