Code example for UsernamePasswordCredentials

     * setBasicAuth("username","password", new AuthScope("host",port,AuthScope.ANY_REALM)) 
     * @param username 
     * @param password 
     * @param scope - an AuthScope object 
    public void setBasicAuth( String user, String pass, AuthScope scope){
        UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(user,pass);
        this.httpClient.getCredentialsProvider().setCredentials(scope, credentials);
     * Cancels any pending (or potentially active) requests associated with the 
     * passed Context. 
     * <p> 
     * <b>Note:</b> This will only affect requests which were created with a non-null 
     * android Context. This method is intended to be used in the onDestroy 
     * method of your android activities to destroy all requests which are no 
     * longer required. 
Experience pair programming with AI  Get Codota for Java