-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ali Karakoç
committed
Jan 4, 2016
0 parents
commit be469c4
Showing
3 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
RequestQueue queue = Volley.newRequestQueue(this); | ||
StringRequest strRequest = new StringRequest(Request.Method.GET, "apiURL", | ||
new Response.Listener<String>() { | ||
@Override | ||
public void onResponse(String response) { | ||
try { | ||
JSONObject o = new JSONObject(response); | ||
JSONArray values = o.getJSONArray("sonuc"); | ||
for (int i = 0; i < values.length(); i++) { | ||
JSONObject sonuc = values.getJSONObject(i); | ||
} | ||
} catch (JSONException ex) { | ||
} | ||
} | ||
}, | ||
new Response.ErrorListener() { | ||
@Override | ||
public void onErrorResponse(VolleyError error) { | ||
Toast.makeText(volleyRequest.this, error.toString(), Toast.LENGTH_SHORT).show(); | ||
} | ||
}); | ||
strRequest.setRetryPolicy(new DefaultRetryPolicy(20 * 1000, 1, 1.0f)); | ||
queue.add(strRequest); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Volley s�n�f�n� kullanmam�z i�in bilmemiz gereken baz� bilgiler; | ||
|
||
1. build.gradle dosyas�m�z�n dep'i i�ine eklememiz gereken gradle; | ||
�rn; 'com.mcxiaoke.volley:library:1.0.19' �eklindedir. Siz a�a��dan en son s�r�m�n� al�p projenize ekleyebilirsiniz. | ||
http://mvnrepository.com/artifact/com.mcxiaoke.volley/library | ||
|
||
��e yarayacak linkler; | ||
1- https://github.com/mcxiaoke/android-volley | ||
2- http://developer.android.com/training/volley/index.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
RequestQueue queue = Volley.newRequestQueue(this); | ||
StringRequest strRequest = new StringRequest(Request.Method.POST, "apiURL", | ||
new Response.Listener<String>() { | ||
@Override | ||
public void onResponse(String response) { | ||
try { | ||
JSONObject o = new JSONObject(response); | ||
JSONArray values = o.getJSONArray("sonuc"); | ||
for (int i = 0; i < values.length(); i++) { | ||
JSONObject sonuc = values.getJSONObject(i); | ||
} | ||
} catch (JSONException ex) { | ||
} | ||
} | ||
}, | ||
new Response.ErrorListener() { | ||
@Override | ||
public void onErrorResponse(VolleyError error) { | ||
Toast.makeText(volleyRequest.this, error.toString(), Toast.LENGTH_SHORT).show(); | ||
} | ||
}) { | ||
@Override | ||
protected Map<String, String> getParams() { | ||
Map<String, String> params = new HashMap<String, String>(); | ||
params.put("put1", "value1"); | ||
params.put("put2", "value3"); | ||
return params; | ||
} | ||
}; | ||
strRequest.setRetryPolicy(new DefaultRetryPolicy(20 * 1000, 1, 1.0f)); | ||
queue.add(strRequest); |