Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Maybe this example will help you :</p> <pre><code>public class URLConnectionTask &lt;Result&gt; extends AsyncTask&lt;URL, Void, InputStream&gt; { @Override protected InputStream doInBackground(URL... params) { InputStream is; HttpUriRequest request; URI uri; HttpResponse response; if (params.length == 0) return null; is = null;CredentialsProvider credProvider = new BasicCredentialsProvider(); if (userName != null &amp;&amp; userName.length() &gt; 0 &amp;&amp; password != null &amp;&amp; password.length() &gt; 0) credProvider.setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT), new UsernamePasswordCredentials(userName, password)); // DefaultHttpClient http = new DefaultHttpClient(); http.setCredentialsProvider(credProvider); // uri = URI.create(params[0].toString()); if (isPost) request = new HttpPost(uri); else request = new HttpGet(uri); try { response = http.execute(request); is = response.getEntity().getContent(); //Log.d(TAG, "doInBackground() response: "+EntityUtils.toString(response.getEntity())); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } if (processingHandler != null &amp;&amp; is != null) processingResult = processingHandler.processResponse(is);// processingHandler is an instance which implements ProcessingHandler interface (ex. VizMarket). processResponse() is implemented on this class. return is; } @Override protected void onPostExecute (InputStream result) { input = result; if (result == null) return; //instruction for inserting data on db .... try { result.close(); } catch (IOException e) { } } } </code></pre>
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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