Android Question get new record after selecting spinner

Makumbi

Well-Known Member
Licensed User
I have a number of records stored in spinner view but after selecting on record i delete the first record and then remain with the rest but the spinner keeps the old record please help

B4X:
cursor1 =Starter.SQL1.ExecQuery2("DELETE  FROM  SMSlist where Atk = ?", Array As String(Rsms4.Text))
B4X:
Sub spnFirstName_ItemClick (Position As Int, Value As Object)
    cursor1 =Starter.SQL1.ExecQuery2("SELECT Account,Phone,Sex,sms,Datesent,Atk FROM SMSlist where Names = ?", Array As String(spnFirstName.SelectedItem))
    
    If cursor1.RowCount<>0 Then
        'user registered
    For i = 0 To cursor1.RowCount - 1
            cursor1.Position = 0
        
                Rsms.Text=cursor1.GetString("sms")
                Log(Rsms.Text)
                Rsms2.Text=cursor1.GetString("Datesent")
                Log(Rsms2.Text)
                Rsms4.Text=cursor1.GetString("Atk")

        
    Next
    End If

End sub
 

skrjabin

Active Member
Licensed User
I don't understand the cursor1.Position = 0 in a for-next loop many times. Do you mean cursor1.Position = i ?
 

aeric

Well-Known Member
Licensed User
You need to read the database again and populate the items into spinner after deleting the record.
 

Makumbi

Well-Known Member
Licensed User
You need to read the database again and populate the items into spinner after deleting the record.
i have made changes as per your suggestion but the record is not changing please can i send the simple project and you see it
 

aeric

Well-Known Member
Licensed User
i have made changes as per your suggestion but the record is not changing please can i send the simple project and you see it
You can post your simplified project here so any members here can help you.
 

Makumbi

Well-Known Member
Licensed User
You need to read the database again and populate the items into spinner after deleting the record.
i have attached this new project it has to problems
1. i wanted to get new record after deleting one the in the spinner list but the spinner s still show the old record after i select the name
2. i i wanted to be able to receive new messages straight away without having to close and open my app (something like a trigger or timer ) which gets new message from my json link please help thanks in advance
 

Attachments

Top