Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Take a look at <a href="http://sarangasl.blogspot.fi/2011/06/android-login-screen-using-httpclient.html" rel="nofollow">this</a> example. </p> <pre><code>private HttpClient mHttpClient; private HttpContext mContext; private CookieStore mCookieStore; public void post(){ ArrayList&lt;BasicNameValuePair&gt; list = new ArrayList&lt;BasicNameValuePair&gt;(); list.add(new BasicNameValuePair("uname", "your username")); list.add(new BasicNameValuePair("password", "your username")); list.add(new BasicNameValuePair("form_submit", "Login")); task mTask = new task(); mTask.execute(list); } public class task extends AsyncTask&lt;ArrayList&lt;BasicNameValuePair&gt;, Void, String&gt;{ @Override protected String doInBackground(ArrayList&lt;BasicNameValuePair&gt;... arg0) { if(mHttpClient == null){ mHttpClient = new DefaultHttpClient(); } if(mContext == null){ mContext = new BasicHttpContext(); } if(mCookieStore == null){ mCookieStore = new BasicCookieStore(); } mContext.setAttribute(ClientContext.COOKIE_STORE, mCookieStore) String sResponse = ""; HttpResponse response = null; try{ HttpPost httppost = new HttpPost("http://www99.imperiaonline.org/imperia/game_v5/game/ajax_login.php"); httppost.setEntity(new UrlEncodedFormEntity(arg0[0])); mHttpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.BROWSER_COMPATIBILITY); response = mHttpClient.execute(httppost, mContext); BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent(), "UTF-8")); StringBuilder s = new StringBuilder(); while ((sResponse = reader.readLine()) != null) { s = s.append(sResponse); } // Getting cookies ArrayList&lt;Cookie&gt; list = new ArrayList&lt;Cookie&gt;(mCookieStore.getCookies()); for(Cookie cookie : list){ Log.i(TAG, "cookie: " + cookie.getName()); } }catch(IOException e){ } return sResponse; } @Override protected void onPostExecute(String result){ System.out.println(result); } } </code></pre>
    singulars
    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. 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