Android Tutorial ScrollView example with multiselection and SQL

Here is another ScrollView example with:
- adding a row
- moving a selected row up and down
- mono-selection, clicking on one row selects it, clicking on another row unselects the previous one and selects the new one.
- multi-selection, after one row is selected, a longclick on another row activates multi-selection, clicking on a third row selects it, clicking on a selected row unselects it. Unselecting down to one selected row reactivates mono-selection.
- deleting rows, mono and multi

Best regards.
 

Attachments

  • ScrollViewMultiselect.zip
    9.5 KB · Views: 4,064
  • ScrollViewMultiselect1.jpg
    ScrollViewMultiselect1.jpg
    48.4 KB · Views: 20,620
  • ScrollViewMultiselect2.jpg
    ScrollViewMultiselect2.jpg
    47.9 KB · Views: 20,073

Tornet91

Member
Licensed User
Longtime User
Thx you! Now it works :)
B4X:
Query = "SELECT * FROM Table1 WHERE Code = ? OR First = ?"
Cursor1 = SQL1.ExecQuery2(Query, Array As String (edtCode.Text, edtFirstName.Text))
 
If Cursor1.RowCount > 0 Then
    'if it exists show a message and do nothing else
    Msgbox("This entry already exists","Error")
Else
    'if not, add the entry
    row(0)=edtCode.Text
    row(1)=edtFirstName.Text
    AddRow(row)
    End If
 

A Z M JANNAT UL KARIM

Member
Licensed User
Hi Klaus, thanks a lot for your great example.
I can't manage to do one thing here. I will not do any background SQL task. Only will save on SQL after save button click. I manage to add and delete here by getting help from your code. But I want to read data from scrollview when user click on Save button. I can't manage to work to read every row from the scrollview. A little help will be great here :) Thanks in Advance...
 

A Z M JANNAT UL KARIM

Member
Licensed User
Hi Klaus, I manage to complete the task. Thank You :)

B4X:
Sub cmdSend_Click
    Dim txtTemp, txtMsg As String
    Dim I, J As Int
    For J = 0 To NumberOfRows-1
        txtTemp = ""
        For I = 0 To 2
            If txtTemp = "" Then
                txtTemp = GetCell(J, I)
            Else
                txtTemp = txtTemp & " / " & GetCell(J, I)
            End If
        Next
        txtMsg = txtMsg & " --- " & txtTemp
    Next
    Msgbox (txtMsg, "Info")
   
End Sub
 
Top