You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 26, 2018. It is now read-only.
public class VinhNT_HTTP implements Response.Listener,Response.ErrorListener {
private VinhNT_Activity context;
private RequestQueue queue;
public VinhNT_HTTP(VinhNT_Activity nguCanh){
context = nguCanh;
// Instantiate the cache
Cache cache = new DiskBasedCache(context.getCacheDir(), 1024 * 1024); // 1MB cap
cache.clear();
//
// Set up the network to use HttpURLConnection as the HTTP client.
Network network = new BasicNetwork(new HurlStack());
//
// Instantiate the RequestQueue with the cache and network.
queue = new RequestQueue(cache,network);
//
}
public void sendRequest() {
//
queue.start();
try{
String url ="http://192.168.0.101/bongda";
JSONObject jsonBody = new JSONObject();
jsonBody.put("user","VinhNT");
jsonBody.put("function", "login");
JsonObjectRequest a = new JsonObjectRequest(Request.Method.POST,url,jsonBody,this,this);
queue.add(a);
//queue.stop();
}
/*catch (JSONException e){
Log.d("Error","JSONException");
}*/
catch (Exception e){
Log.d("Error","JSONException"+ e.getMessage());
}
}
public void cancelAll(){
queue.cancelAll(context.getTitle_VinhNT());
}
@Override
public void onResponse(JSONObject response) {
Log.d("Ket noi","OK roi nhe");
}
@Override
public void onErrorResponse(VolleyError error) {
Log.d("Ket noi","Loi roi");
}
}
That doesn't send JSONObject to PHP server:
please help me, many thank
The text was updated successfully, but these errors were encountered:
I'm trying with code:
public class VinhNT_HTTP implements Response.Listener,Response.ErrorListener {
private VinhNT_Activity context;
private RequestQueue queue;
public VinhNT_HTTP(VinhNT_Activity nguCanh){
context = nguCanh;
// Instantiate the cache
Cache cache = new DiskBasedCache(context.getCacheDir(), 1024 * 1024); // 1MB cap
cache.clear();
//
// Set up the network to use HttpURLConnection as the HTTP client.
Network network = new BasicNetwork(new HurlStack());
//
// Instantiate the RequestQueue with the cache and network.
queue = new RequestQueue(cache,network);
}
That doesn't send JSONObject to PHP server:
please help me, many thank
The text was updated successfully, but these errors were encountered: