Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public String jsonResponse;
- public void GetDBInformation(String infoType) {
- String GetURL = "";
- if (infoType.equals("Specie"))
- GetURL = "http://apigeoma.novohorizonte.sp.gov.br/Api/Especies";
- else if (infoType.equals("City"))
- GetURL = "http://apigeoma.novohorizonte.sp.gov.br/Api/Cidades";
- else if (infoType.equals("Street"))
- GetURL = "http://apigeoma.novohorizonte.sp.gov.br/Api/Ruas";
- else if (infoType.equals("Recommendation"))
- GetURL = "http://apigeoma.novohorizonte.sp.gov.br/Api/Recomendacoes";
- StringRequest stringRequest = new StringRequest(Request.Method.GET, GetURL,
- new Response.Listener<String>() {
- @Override
- public void onResponse(String response) {
- jsonResponse = response;
- CharSequence text = "Response: " + response;
- int duration = Toast.LENGTH_SHORT;
- Toast toast = Toast.makeText(ctx, text, duration);
- toast.show();
- }
- },
- new Response.ErrorListener() {
- @Override
- public void onErrorResponse(VolleyError error) {
- CharSequence text = "Erro Voley!";
- int duration = Toast.LENGTH_SHORT;
- Toast toast = Toast.makeText(ctx, text, duration);
- toast.show();
- }
- });
- RequestQueue requestQueue = Volley.newRequestQueue(ctx);
- requestQueue.add(stringRequest);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement