Android Question Empty screen from last to first record

Discussion in 'Android Questions' started by Enthousiastic, Jun 16, 2015.

  1. Enthousiastic

    Enthousiastic Active Member Licensed User

    Hello , i have a database for mine magazines. All are oK. Recently i shaw an isuue that i did't shee before.
    I have some buttons to navigate the first , last , next , previous records . I shaw when i press the last button , it goes to the last record and it's OK. When from this position i press the previous button , also goes to the previous . But when i am in the last record and i press the first button , to go to the first record the screen become empty and seems like freesing without displaying anything. In debug mode and in logs , there is nothing message. The code is as follows :



    Sub LoadRecords

    ' Dim t As Long
    Curs.Position =RecIndex

    lblAmID2.Text = Curs.GetString2(0)
    lblAmPCode2.Text = Curs.GetString2(1)
    lblAmAch2.Text = Curs.GetString2(2)
    lblAmMY2.Text = Curs.GetString2(3)
    lblPage2.Text = Curs.GetString2(4)
    lblTitle2.Text = Curs.GetString2(5)
    lblCategory2.Text = Curs.GetString2(6)
    lblSpeaker2.Text = Curs.GetString2(7)
    lblOrigin2.Text = Curs.GetString2(8)
    lblSuccLevel2.Text = Curs.GetString2(9)
    lblSuccMY2.Text = Curs.GetString2(10)
    lblPhotoYN2.Text = Curs.GetString2(11)
    lblTefxos2.Text = Curs.GetString2(12)
    lblPinPhoto2.Text = Curs.GetString2(13)
    lblPdfFile2.Text = Curs.GetString2(14)
    lblExofyllo2.Text = Curs.GetString2(15)


    RecIndex1 = RecIndex + 1
    Activity.Title= "Record/s : " & RecIndex1 & " From : " & RecNum



    End Sub

    Sub btnFirst_Click
    RecIndex=0
    Msgbox("This is the 1st record", "ATTENTION!")
    Activity.RemoveAllViews
    LoadRecords
    End Sub


    Sub btnPrev_Click

    RecIndex = Max(RecIndex - 1, 0)

    LoadRecords

    End Sub


    Sub btnNext_Click

    RecIndex = Min(RecIndex + 1, Curs.RowCount - 1)

    LoadRecords
    End Sub


    Sub btnLast_click

    RecIndex = Curs.RowCount - 1
    Msgbox("Thi sis the last record ", "ATTENTION!")

    LoadRecords
    End Sub


    Any idea , what is wrong ?
    Thanks Enthousiastic !
     
  2. sorex

    sorex Expert Licensed User

    you remove everything with this

    Code:
    Sub btnFirst_Click
    RecIndex=
    0
    Msgbox("This is the 1st record""ATTENTION!")
    Activity.RemoveAllViews   <- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    LoadRecords
    End Sub
     
  3. Enthousiastic

    Enthousiastic Active Member Licensed User

    Do you suggest to add Activity.RemoveAllViews to the next , last and previous click events ?
     
  4. Mahares

    Mahares Well-Known Member Licensed User

    Sorex is telling you to get rid of the line: Activity.RemoveAllViews or comment it, not add it to any.
    By the way, you should really use code tags when you display a lot of code, because you have been a member for 3 years.
     
  5. sorex

    sorex Expert Licensed User

    right, you remove everything visible in your app that's why you end up with an empty screen.

    remove it or modify it to the panel you want to clear.
     
Loading...