Code example for DefaultHttpClient

Methods: executegetCredentialsProvider

    public String sendGet(URI uri, String username, String password) {
        httpGet = new HttpGet(uri);  
		Credentials creds = new UsernamePasswordCredentials(username, password);
		AuthScope authscope = new AuthScope(uri.getHost(), uri.getPort());
		httpClient.getCredentialsProvider().setCredentials(authscope, creds);
        try { 
            response = httpClient.execute(httpGet);  
        } catch (Exception e) {
            Log.e("Your App Name Here", e.getMessage());
        //int status = response.getStatusLine().getStatusCode();   
        String ret = null;
        // we assume that the response body contains the error message   
        try { 
            ret = EntityUtils.toString(response.getEntity());  
        } catch (IOException e) {
Connect your IDE to all the code out there  Get Codota for Java