Android Question ScrollView Problem.

dragonguy

Active Member
Licensed User
Longtime User
I'm create the database to store the connection profile, after add the record i cannot view it at scroll view.
here is my code:

Code: Copy
Sub Process_Globals
    Dim SQL1 As SQL
    Dim RowNumber = 0 As Int
End Sub

Code: Copy
Sub Globals
    Private btn_add_server_list As Button
    Private ScrollView1 As ScrollView
End Sub

Code: Copy
Sub Activity_Create(FirstTime As Boolean)
    If FirstTime Then
        If File.Exists(File.DirInternal, "smarthome.db") = False Then
            SQL1.Initialize(File.DirInternal, "smarthome.db", True)
            CreateDataBase
        Else
            SQL1.Initialize(File.DirInternal, "smarthome.db", True)
        End If
    End If
    Activity.LoadLayout("ConnectionLayout")
    ReadDataBase                
End Sub

Code: Copy
Sub ReadDataBase
    Dim Row As Int
    Dim Cursor1 As Cursor
    Dim ConnectionName As String
    Dim IPAddress As String
    Dim Port As String
   
    Cursor1 = SQL1.ExecQuery("SELECT ConnectionName,IPAddress,Port FROM ConnectionProfile")
    If Cursor1.RowCount > 0 Then                      
        RowNumber = Cursor1.RowCount     'here i have 5 records              
        For Row = 0 To RowNumber - 1
            Cursor1.Position = Row                      
            ConnectionName = Cursor1.GetString("ConnectionName")
            IPAddress = Cursor1.GetString("IPAddress")
            Port = Cursor1.GetString("Port")
            Dim lbl As Label
            lbl.Initialize("")
            lbl.Text = ConnectionName & " - " & IPAddress & ":" & Port
            ScrollView1.Panel.AddView(lbl,0,50dip*(Row-1),120dip,50dip)
        Next                                   
    End If
    Cursor1.Close                                  
End Sub
Screenshot_2014-03-04-16-29-07.png

Can i add long press then show menu at ScrollView or not ?
 
Back
Top