Hi!
I new in b4a, ant try to create a simple application.
i need to use a label ant that label's text change from database. The datas from database shown an on the fly created listview. But i press a back button (eg cancel) on listview, the all program is go background. I found a snipplet to handle the back button, but i dont know how to knpw what view is ontop or active
My theory is:
if the back button is pressed, i check witch view is on top, (in this case the "on the fly" created listview) and i remove it. if no "on the fly" created view on main layout, i'm tell the system kick my program to background.
my code:
This sub fill the listview from database. (theoretically, my db is empty)
Thanks!
Aubete
I new in b4a, ant try to create a simple application.
i need to use a label ant that label's text change from database. The datas from database shown an on the fly created listview. But i press a back button (eg cancel) on listview, the all program is go background. I found a snipplet to handle the back button, but i dont know how to knpw what view is ontop or active
My theory is:
if the back button is pressed, i check witch view is on top, (in this case the "on the fly" created listview) and i remove it. if no "on the fly" created view on main layout, i'm tell the system kick my program to background.
my code:
This sub fill the listview from database. (theoretically, my db is empty)
B4X:
Sub partlist_Click
Dim selsom As ListView
selsom.Initialize("selsom_click")
Activity.AddView(selsom,5,5,100%x -5dip,100%y -5dip)
Dim Cursor1 As Cursor
Cursor1 = db.ExecQuery("SELECT nev, ROWID from partner")
If Cursor1.RowCount > 0 Then
For i = 0 To Cursor1.RowCount - 1
Cursor1.Position = i
selsom.AddSingleLine(Cursor1.GetInt("ROWID") & "-" & Cursor1.GetString("nev"))
Next
selsom.AddSingleLine("Add new...")
Else
ToastMessageShow("Empty database, use add new",True)
selsom.AddSingleLine("Add new...")
End If
Cursor1.Close
selsom.BringToFront
selsom.Color = Colors.Black
selsom.SingleLineLayout.Label.TextColor = Colors.White
End Sub
Thanks!
Aubete