Hi everyone, I have a sqlite database in my app, I use it to store products from a pizzeria in a spinner, I have a problem, when I insert a product and then I save it and after storing in the spinner for example 5 elements and I would like to delete the third element because I was wrong in writing the name of the element and therefore after having eliminated it I would like to be able to always insert on the same place (in third place) the element just removed, instead it adds it to the end of the spinner, these are the codes I use for save the item and delete the item.
this is the code to delete the item
if the element was removed in the third position of the spinner, how can I always put it back in the same position?
B4X:
Sub btnm1_Click
dbSQL.ExecNonQuery2("INSERT INTO field1 VALUES (?)", Array As String(txtmenu.Text & " - " & "Euro" & " " & txtcaricoeuro.Text))
spm1.Add (txtmenu.Text & " " & "Euro" & " " & txtcaricoeuro.Text)
txtcaricoeuro.Text="" ' pulisco la casella di testo txtcaricoeuro.text
dbCursor.Close
Msgbox("item added","stored")
txtmenu.Text=""
phone1.HideKeyboard(Activity)
txtcaricoeuro.Text=0
End Sub
B4X:
Sub btnm1_LongClick
dbSQL.ExecNonQuery2("DELETE FROM field1 WHERE data1 = ?", Array As String(spm1.SelectedItem))
Msgbox ("item removed from spinner menù ","NOTE")
reset
end sub
if the element was removed in the third position of the spinner, how can I always put it back in the same position?