Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim SQL1 As SQL
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
'DECLARE - Variables
Dim Job1 As HttpJob
'INITIALIZE - Job1
Job1.Initialize("Job1", Me)
'GET - Logos
Job1.Username = "username"
Job1.Password = "password"
Job1.Download("http://myurl/logos.db")
End Sub
Sub JobDone(Job As HttpJob)
If Job.Success = True Then
Select Job.JobName
Case "Job1"
'INITIALIZE - OutputStream
Dim OutStream As OutputStream
'READ - db file
OutStream = File.OpenOutput(File.DirDefaultExternal, "logos.db", False)
'SAVE - db file
File.Copy2(Job.GetInputStream,OutStream)
'CLOSE - OutputStream
OutStream.Close
'DEFINE - Bitmaps
Dim bmpChLogo As Bitmap
'INIT - Cursors
Dim Cursor1 As Cursor
'INIT - SQL1
SQL1.Initialize(File.DirDefaultExternal, "logos.db", True)
'QUERY - DB
Cursor1 = SQL1.ExecQuery2("SELECT tvg_logo, png_logo FROM logos WHERE tvg_logo = ?", Array As String("hrt1"))
'SET - Position
Cursor1.Position = 0
'DECLARE - Buffers
Dim Buffer() As Byte
'READ - Bloob
Buffer = Cursor1.GetBlob("png_logo")
'DECLARE - InputStreams
Dim InputStream1 As InputStream
'INITIALIZE - InputStreams
InputStream1.InitializeFromBytesArray(Buffer, 0, Buffer.Length)
'INIT - Bitmaps
bmpChLogo.Initialize2(InputStream1)
End Select
End If
End Sub
[CODE]