Day 2 : Kotlin Api Call using Volley

by Start Bootstrap


Posted on Feb 21, 2019


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

Just add the dependency

implementation 'com.android.volley:volley:1.1.1' // migrating to implementation is important

And here we do the GET Method

val queue = Volley.newRequestQueue(this);
val stringRequest = StringRequest(Request.Method.GET, "http://sulthanallaudeen.com/api/v1/ping",
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();
})
queue.add(stringRequest);

And this makes entire process easy !! 


Search
Side Widget
You can put anything you want inside of these side widgets. They are easy to use, and feature the new Bootstrap 4 card containers!