ba_maram_shiraz
New Member
hey guys im newbie in B4A
i want clear my created buffer :
this is my code , when i press the Button1 i send a request , so when my_StreamFinish called a() variable have last values and listView show these.
for example in first click i have 1 and it add to list view when click on butten again list view show 12 but it should show 2 and when again click it show 123 but it should show 3 .
what should i do ??
sorry for bad english.
i want clear my created buffer :
B4X:
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim hc As HttpClient
Dim hr As HttpRequest
Dim hj As HttpResponse
Dim i As OutputStream
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim Button1 As Button
Dim ListView1 As ListView
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
hc.Initialize("hc")
End If
i.InitializeToBytesArray(0)
Activity.LoadLayout("b")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub hc_ResponseSuccess (Response As HttpResponse, TaskId As Int)
Response.GetAsynchronously("my",i,True,1)
End Sub
Sub hc_ResponseError (Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
Msgbox(Reason,"s")
End Sub
Sub my_StreamFinish (Success As Boolean, TaskId As Int)
Dim a() As Byte
Dim s As String
a = i.ToBytesArray()
s = BytesToString(a,0,a.Length,"UTF-8")
ListView1.AddSingleLine(s)
End Sub
Sub Button1_Click
hr.InitializeGet("http://192.168.1.5/page_test/curl/login.php")
hc.Execute(hr,1)
End Sub
this is my code , when i press the Button1 i send a request , so when my_StreamFinish called a() variable have last values and listView show these.
for example in first click i have 1 and it add to list view when click on butten again list view show 12 but it should show 2 and when again click it show 123 but it should show 3 .
what should i do ??
sorry for bad english.