Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- val request = object : StringRequest(Request.Method.GET, url, Response.Listener { response ->
- if (response != null) {
- Log.e("Your Array Response", response)
- } else {
- Log.e("Your Array Response", "Data Null")
- }
- }, Response.ErrorListener { error -> Log.e("error is ", "" + error) }) {
- override fun getHeaders() : Map<String, String> {
- val username ="admin"
- val password = "admin"
- val auth = "$username:$password"
- var data = auth.toByteArray()
- var base64 = Base64.encodeToString(data, Base64.NO_WRAP)
- var headers = HashMap<String, String>()
- headers.put("Authorization",base64)
- headers.put("accept-language","EN")
- headers.put("Content-type","application/json")
- headers.put("Accept","application/json")
- return headers
- }
- }
- val queue = Volley.newRequestQueue(this)
- queue.add(request)
Add Comment
Please, Sign In to add comment