Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid http post as a service
    primarykey
    data
    text
    <p>can any one please tell me how to make this code work in the background and what is the difference when i make the code work in the background as in "do in background" and a service and which approach should i take</p> <p>thanks to all in advance</p> <p>this is the code:</p> <pre><code>public void SticketFunction(double book, double libadd, long time){ Log.v("log_tag", "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SticketFunction()"); //HttpClient HttpClient nnSticket = new DefaultHttpClient(); //Response handler ResponseHandler&lt;String&gt; res = new BasicResponseHandler(); HttpPost postMethod = new HttpPost("http://www.books-something.com"); try { List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(5); nameValuePairs.add(new BasicNameValuePair("book", book+"")); nameValuePairs.add(new BasicNameValuePair("libAss", libass+"")); nameValuePairs.add(new BasicNameValuePair("Time", time+"")); nameValuePairs.add(new BasicNameValuePair("name", "jack")); //Encode and set entity postMethod.setEntity(new UrlEncodedFormEntity(nameValuePairs, HTTP.UTF_8)); //Execute //manSticket.execute(postMethod); String response =Sticket.execute(postMethod, res).replaceAll("&lt;(.|\n)*?&gt;",""); if (response.equals("Done")){ //Log.v("log_tag", "!!!!!!!!!!!!!!!!!! SticketFunction got a DONE!"); } else Log.v("log_tag", "!!!!!!!?????????? SticketFunction Bad or no response: " + response); } catch (ClientProtocolException e) { // TODO Auto-generated catch block //Log.v("log_tag", "???????????????????? SticketFunction Client Exception"); } catch (IOException e) { // TODO Auto-generated catch block //Log.v("log_tag", "???????????????????? IO Exception"); } } } </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. 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