Day 2 : Kotlin Api Call using Volley

1550707200000 Kotlin

by Start Bootstrap

Api call using Volley is very much easier. Yes, code is drastically reduced here

Just add the dependency

implementation '' // migrating to implementation is important

And here we do the GET Method

val queue = Volley.newRequestQueue(this);
val stringRequest = StringRequest(Request.Method.GET, "",
Response.Listener<String> { response ->
Toast.makeText(this@LoginActivity, response, Toast.LENGTH_SHORT).show();
Response.ErrorListener {
Toast.makeText(this@LoginActivity, "Error in API Request", Toast.LENGTH_SHORT).show();

And this makes entire process easy !!