How to make Http Authentication for API using Volley library ?
I tried the following code ....it throws Runtime Exception & Null pointer exception..Please provide suggestions
String url = "Site url";
String host = "hostName";
int port = 80;
String userName = "username";
String password = "Password";
DefaultHttpClient client = new DefaultHttpClient();
AuthScope authscope = new AuthScope(host, port);
Credentials credentials = new UsernamePasswordCredentials(userName, password);
client.getCredentialsProvider().setCredentials(authscope, credentials);
HttpClientStack stack = new HttpClientStack(client);
RequestQueue queue = Volley.newRequestQueue(VolleyActivity.this, stack);
AjaxOptions
documentation for adding a username and password to a request. – Treasatreason