ShowEntry(EntryIndex As Int)
...
.
.
Else
ID = Activity2.IDList.Get(EntryIndex) 'get the ID for the given entry index
'read the entry with the given ID
Cursor1 = Activity2.SQL1.ExecQuery("SELECT * FROM persons INNER JOIN body ON persons.ID = body.IDbody WHERE ID = " & ID)
edtID.Text = ID 'display the ID
For i=0 To Cursor1.RowCount-1
Cursor1.Position = i 'set the cursor
edtFirstName.Text = Cursor1.GetString("FirstName") 'read the value of the FirstName column
edtLastName.Text = Cursor1.GetString("LastName") 'read the value of the LasstName column
'edtSex.Text = Cursor1.GetString("Sex")
edtBirthDay.Text = Cursor1.GetString("BirthDay") 'read the value of the City column
edtBirthCity.Text = Cursor1.GetString("BirthCity")
edtFatherName.Text = Cursor1.GetString("FatherName")
edtBoy.Text = Cursor1.GetString("Boy")
'ImageView1.BLOB = Cursor1.GetBlob("Resim")
spnCinsiyet.Prompt = "Cinsiyet"
spnCinsiyet.Add(Cursor1.GetString("Sex"))
If Cursor1.GetString("Sex")= ("Erkek") Then
spnCinsiyet.Add("Bayan") // Women
spinnerMap.Put("Bayan", "id 3")
Else
spnCinsiyet.Add("Erkek") // Man
spinnerMap.Put("Erkek", "id 2")
End If
Next
Cursor1.Close 'close the cursor, we don't it anymore
End If
Sub spnCinsiyet_ItemClick (Position As Int, Value As Object)
Dim id As String
id = spinnerMap.Get(Value)
End Sub
spnCinsiyet.Add(Cursor1.GetString("Sex"))
If Cursor1.GetString("Sex")= ("Erkek") Then
spnCinsiyet.Add("Bayan")
spinnerMap.Put("Bayan", "id 3")
Else
spnCinsiyet.Add("Erkek")
spinnerMap.Put("Erkek", "id 2")
End If
Put this code in Activity_Create:You should fill the spinner only once with the two possibilities
spnCinsiyet.Clear
spnCinsiyet.Add("Bayan")
spnCinsiyet.Add("Erkek")
spnCinsiyet.Prompt = "Cinsiyet"
In in ShowEntry change the code above to:When you select a person you should set the selected item in the spinner according to value for the given person.
If Cursor1.GetString("Sex")= ("Erkek") Then
spnCinsiyet.SelectedIndex = 1
Else
spnCinsiyet.SelectedIndex = 0
End If