Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed help creating Digest authentication for Android
    primarykey
    data
    text
    <p>I have this code so far:</p> <pre><code>private class DownloadWebPageTask extends AsyncTask&lt;String, Void, String&gt; { @Override protected String doInBackground(String... theParams) { String myUrl = theParams[0]; String myEmail = theParams[1]; String myPassword = theParams[2]; HttpPost post = new HttpPost(myUrl); post.addHeader("Authorization","Basic "+ Base64.encodeToString((myEmail+":"+myPassword).getBytes(), 0 )); ResponseHandler&lt;String&gt; responseHandler = new BasicResponseHandler(); String response = null; try { response = client.execute(post, responseHandler); InputStream content = execute.getEntity().getContent(); BufferedReader buffer = new BufferedReader( new InputStreamReader(content)); String s = ""; while ((s = buffer.readLine()) != null) { response += s; } } catch (Exception e) { e.printStackTrace(); } return response; } @Override protected void onPostExecute(String result) { } } </code></pre> <p>This code does not compile because I am running into confusion at the point of:</p> <pre><code> response = client.execute(post, responseHandler); InputStream content = execute.getEntity().getContent(); </code></pre> <p>I got that code from tinkering with various examples, and not sure what Object the client is supposed to be, and whether the first line will just get me the server response, or I have to go the route of getting the InputStream and reading the server response in?</p> <p>Please help me understand how to do this correctly.</p> <p>Thank you!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload