Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private xui As XUI
Private SpTimer As Timer
Private sqlDB As SQL
Type RecordData (ArtistName As String, AlbumName As String)
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
Private TstPrgrsBar As ProgressBar
Private contentListView As ListView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
SpTimer.Initialize("SpTimer",4000)
SpTimer.Enabled = True
' For x = 0 To 4000 -1
' TstPrgrsBar.Progress = x
' Sleep(2)
' Next
If File.Exists (File.DirInternal , "inbrcodes.db") = False Then
File.Copy(File.DirAssets , "inbrcodes.db" , File.DirInternal , "inbrcodesConfirm.db")
End If
sqlDB.Initialize(File.DirInternal,"inbrcodesConfirm.db",True)
End Sub
Sub SpTimer_Tick
Activity.RemoveAllViews
SpTimer.Enabled = False
Activity.LoadLayout("layMain")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
xui.MsgboxAsync("Hello world!", "B4X")
End Sub
Private Sub exitbtn_Click
Dim exitvalue As Int
exitvalue = Msgbox2 ( "آیا از خروج اطمینان دارید؟" , "پیام خروج" , " بله " , "خیر" , "" , Null)
If (exitvalue = DialogResponse.POSITIVE) Then
ExitApplication
End If
End Sub
Private Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
If KeyCode = KeyCodes.KEYCODE_BACK Then
Dim exitvalue As Int
exitvalue = Msgbox2 ( "آیا از خروج اطمینان دارید؟" , "پیام خروج" , " بله " , "خیر" , "" , Null)
If (exitvalue = DialogResponse.POSITIVE) Then
ExitApplication
Else
Return True
End If
End If
End Sub
Private Sub contentListView_ItemClick (Position As Int, Value As Object)
End Sub
Sub MainListBtn_Click
Activity.RemoveAllViews
Activity.LoadLayout("laycontent")
Dim Cur As Cursor
Dim strContentList As String
'don't do Dim sqlDB As SQL here !!
Cur = sqlDB.ExecQuery ("Select * FROM tblContent")
For i = 0 To Cur.RowCount -1
Cur.Position = i
strContentList = Cur.GetString("ContentList")
contentListView.AddSingleLine2 (strContentList,i)
Next
contentListView.SingleLineLayout.Label.TextColor = Colors.Black
End Sub