This is how I am using it:
public Request<?> deleteUser(String id, final String loginName, final String password,
Response.Listener responseListener,
Response.ErrorListener errorListener) {
final int method = Request.Method.DELETE;
final Map<String, String> authHeaders = getAuthHeaders(loginName, password);
StringRequest request = new StringRequest(method, url, responseListener, errorListener) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
return authHeaders;
}
};
return mQueue.add(request);
}
public Map<String, String> getAuthHeaders(String loginName, String password) {
HashMap<String, String> params = new HashMap<String, String>();
String creds = String.format("%s:%s", loginName, password);
String auth = "Basic " + Base64.encodeToString(creds.getBytes(), Base64.DEFAULT);
params.put("Authorization", auth);
return params;
}