Android Question Some help with adapting TableExample

Discussion in 'Android Questions' started by Lary Yenta, Apr 29, 2015.

  1. Lary Yenta

    Lary Yenta Member Licensed User

    Hey folks,

    I am trying to get a list view of one of my Database Tables and I keep getting dumped out of my program.

    The code I have written looks like:

    Code:
    Sub Activity_Create(FirstTime As Boolean)
      
    Dim Cursor1 As Cursor
       
    Dim SQL1 As SQL
       
    Dim Qry As String
       Table1.Initialize(Me, 
    "Medications"4)
       Table1.AddToActivity(
    Activity00dip100%x50%y)   
       Table1.SetHeader(
    Array As String("Name""Dose""Frequency""Comments"))
     
       Qry = 
    "SELECT meds.MedID, meds.MedName, meds.MedDose, meds.MedFreq, meds.MedComm FROM meds inner join users " & _
       
    "on users.ID = meds.UserID where meds.UserID = " & Main.MastUID
       
    'ToastMessageShow(Qry, True)
      Cursor1 = SQL1.ExecQuery(Qry)   
       
    For i = 0 To Main.MIDList.Size - 1
        Cursor1.Position = i
         
    'Cursor1.GetInt("MedID")
         Table1.AddRow(Array As String(Cursor1.GetString("MedName"), Cursor1.GetString("MedDose"), Cursor1.GetString("MedFreq"), Cursor1.GetString("MedComm")))
         
    'Table1.AddRow(Array As String("Row: " & i, "ccc", "ddd", "eee"))
       Next
       Table1.SetColumnsWidths(
    Array As Int(100dip100dip100dip100%x - 300dip))
       
    'Activity.AddMenuItem("Jump To 3000", "Jump1")
       'Activity.AddMenuItem("Jump To 0", "Jump2")
       
       
    'Table2.Initialize(Me, "Table2", 0)
       'Table2.AddToActivity(Activity, 0, 55%y, 100%x, 45%y)
       'Table2.LoadTableFromCSV(File.DirAssets, "citylist.csv", True)
    End Sub
    Any help would be appreciated

    regards,

    Lary
     
  2. eurojam

    eurojam Well-Known Member Licensed User

    are you sure that the cursor position which you derived from a list from your main activity has the same size like the query result in your cursor?
     
  3. Lary Yenta

    Lary Yenta Member Licensed User

    Yes, I double checked and the list sizes are the same

    Thanks,

    Lary
     
  4. klaus

    klaus Expert Licensed User

    Why don't you use
    For i = 0 To Cursor1.RowCount - 1
    instead of
    For i = 0 To Main.MIDList.Size - 1

    What TableExample version are you speaking of.
    In the Flexible Table Class you have a function LoadSqliteDB.
     
  5. Lary Yenta

    Lary Yenta Member Licensed User

    Hi Klaus,

    I tried loading the Table V1.42 but it would not load for me I got an error message as follows:

    Code:
    If FirstTime Then
    '     File.Delete(File.DirDefaultExternal, DBFileName)   ' for testing to remove an old file

         
    If File.Exists(File.DirDefaultExternal, DBFileName) = False Then
           
    File.Copy(File.DirAssets, DBFileName, DBFileDir, DBFileName)  <=====Program paused here
         
    End If
         SQL1.Initialize(DBFileDir, DBFileName, 
    True)
    '     CreateTestDB   'Test for big numbers
       End If
    Lary
     
  6. klaus

    klaus Expert Licensed User

    Download the latest version 1.43.
    The modifications in LoadSQLiteDB didn't work OK in all cases.
     
  7. Lary Yenta

    Lary Yenta Member Licensed User

    Hi Klaus,

    Where would I find Version 1.43? I tried a search and the best I got was version 1.42.

    Thanks,

    Lary
     
  8. Lary Yenta

    Lary Yenta Member Licensed User

    DOH!!!!

    I must be tired, I found it....Facepalm

    Thanks,

    lary
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice