Try posting your code here, then we can help you out more
Sent from my DROIDX
Sub Process_Globals
Dim hc As HttpClient
Dim PLAYER_LIST As Int
PLAYER_LIST = 1
End Sub
Sub Globals
Type TwoLines (First As String, Second As String)
Dim ListView1 As ListView
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
hc.Initialize("hc")
End If
Activity.LoadLayout("HighScores")
FetchCountriesList
End Sub
Sub FetchCountriesList
ProgressDialogShow("Fetching list of countries")
'Gets all the available countries
ExecuteRemoteQuery("SELECT PlayerName, HighScore FROM HighScores ORDER BY HighScore", PLAYER_LIST)
End Sub
Sub ExecuteRemoteQuery(Query As String, TaskId As Int)
Dim req As HttpRequest
req.InitializePost2("http://localhost/HighScores.php", Query.GetBytes("UTF8"))
hc.Execute(req, TaskId)
End Sub
Sub hc_ResponseError (Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
Log("Error: " & Reason & ", StatusCode: " & StatusCode)
If Response <> Null Then
Log(Response.GetString("UTF8"))
Response.Release
End If
ProgressDialogHide
End Sub
Sub hc_ResponseSuccess (Response As HttpResponse, TaskId As Int)
Dim res As String
res = Response.GetString("UTF8")
Log("Response from server: " & res)
Dim parser As JSONParser
parser.Initialize(res)
Select TaskId
Case PLAYER_LIST
Dim players As List
players = parser.NextArray 'returns a list with maps
For i = 0 To 4
Dim m As Map
m = players.Get(i)
'We are using a custom type named TwoLines (declared in Sub Globals).
'It allows us to later get the two values when the user presses on an item.
Dim tl As TwoLines
tl.First = m.Get("PlayerName")
tl.Second = m.Get("HighScore")
ListView1.AddTwoLines2(tl.First, tl.Second, tl)
Next
ProgressDialogHide
End Select
Response.Release
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub