how to use Digest authentication in android?
<p>I am creating an Android app where I am authenticating username/password through a server.Initially server was implementing <code>Basic</code> authentication so my code was working fine but now server has changed to <code>Digest</code> authentication so my old code is not working.</p>

<p>What changes should do make for using <code>Digest</code> authentication?</p>

<p>My code is as follows:</p>

<pre><code>private boolean authenticateUser() 

{

   try 
   {
        String url_str = "http:serverweb.com/checkauthentication.php"; 

        HttpPost post = new HttpPost(url_str);

        Log.v("AUTHENTICATION URL = ", url_str);
        post.addHeader("Authorization","Basic "+getCredentials());
        ResponseHandler&lt;String&gt; responseHandler=new BasicResponseHandler();
        String response_body = client.execute(post, responseHandler);

        Log.v("SERVER RESPONSE DATA = ", response_body);

        XMLDataParser.parseXML(XMLDataParser.USER_INFORMATION_PARSER_CODE, response_body);

        List&lt;Cookie&gt; cookies = client.getCookieStore().getCookies();
        if (!cookies.isEmpty()) 
        {
         for (int i = 0; i &lt; cookies.size(); i++) 
         {
           XMLData.cookie = cookies.get(i);
         }
        }

        return true;
    }
    catch (MalformedURLException mue) 
    { 
      Log.i("MalformedURLException", " "+mue.getMessage());
      displayDialog("User Does Not exist");
      return false;
    } 
    catch (IOException ioe) 
    { 
       Log.i("IOException", " "+ioe.getMessage());
       displayDialog("User Does Not exist");
       return false;
    }
    catch (Exception e) 
    { 
       Log.i("Exception", " "+e.getMessage());
       displayDialog("Error");
       return false;
    }
}
private String getCredentials()
{
    String u=edit_username.getText().toString();
    String p=edit_password.getText().toString();

    Log.v("USER NAME = ",u);
    Log.v("PASSWORD = ",p);
    return(Base64.encodeBytes((u+":"+p).getBytes()));
}
</code></pre>
