Guest User

Untitled

a guest
Jul 24th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. val request = object : StringRequest(Request.Method.GET, url, Response.Listener { response ->
  2. if (response != null) {
  3. Log.e("Your Array Response", response)
  4. } else {
  5. Log.e("Your Array Response", "Data Null")
  6. }
  7. }, Response.ErrorListener { error -> Log.e("error is ", "" + error) }) {
  8.  
  9.  
  10. override fun getHeaders() : Map<String, String> {
  11. val username ="admin"
  12. val password = "admin"
  13. val auth = "$username:$password"
  14. var data = auth.toByteArray()
  15. var base64 = Base64.encodeToString(data, Base64.NO_WRAP)
  16. var headers = HashMap<String, String>()
  17. headers.put("Authorization",base64)
  18. headers.put("accept-language","EN")
  19. headers.put("Content-type","application/json")
  20. headers.put("Accept","application/json")
  21. return headers
  22. }
  23. }
  24. val queue = Volley.newRequestQueue(this)
  25. queue.add(request)
Add Comment
Please, Sign In to add comment