Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim listview1 As ListView
Dim imageload ="Imageload" As String
Private ImageView1 As ImageView
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("test")
'listview1.SetLayout(0,0,100%x,100%y)
ExecuteRemoteQuery("SELECT logo FROM MS_Markets_tb",imageload)
End Sub
Sub ExecuteRemoteQuery(Query As String, JobName As String)
Dim job As HttpJob
job.Initialize(JobName, Me)
job.PostString("http://khalidvb.com/Android_Conn/MobileConn.php", Query)
End Sub
Sub JobDone(Job As HttpJob)
ProgressDialogHide
If Job.Success Then
Dim res As String
res = Job.GetString
Log("Response from server: " & res)
Dim parser As JSONParser
parser.Initialize(res)
Select Job.JobName
Case imageload
Dim UserDetails As List
UserDetails = parser.NextArray 'returns a list with maps
For i = 0 To UserDetails.Size - 1
Dim X As Map
X = UserDetails.Get(i)
Dim b() As Byte
Dim bmp As Bitmap
Dim s As StringUtils
Dim ix As InputStream
b =s.DecodeBase64(x.Get("logo"))
ix.InitializeFromBytesArray(b,0,b.Length)
bmp.Initialize2(ix)
ix.Close
listview1.AddTwoLinesAndBitmap("LULU","LuLu Hypermarket", bmp)
Next
End Select
Else
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
End Sub