Note that there are some explanatory texts on larger screens.

plurals
  1. POPost Data to server using http post and get response true or false in android
    primarykey
    data
    text
    <p>I want to Post <code>EmailID</code> and <code>Password</code> using <code>AsyncTask</code> and get response True or false, how to do that. we are using <code>json</code>. I have seen some links but can't understand. below is my code. Thanks in advance.</p> <pre><code>private class GetLoginDataTask extends AsyncTask&lt;Void, Void, String[]&gt; { @Override protected void onPreExecute() { super.onPreExecute(); m_ProgressDialog = ProgressDialog.show(Login.this, "Please wait..", "Retrieving data ...", true); m_ProgressDialog.setContentView(R.layout.progress); m_ProgressDialog.show(); } @Override protected String[] doInBackground(Void... params) { // Simulates a background job. String mStrings[] = { "" }; try { HttpClient client = new DefaultHttpClient(); String postURL = "http://192.168.0.126/MeritServices/MeritService.svc/Login"; HttpPost post = new HttpPost(postURL); List&lt;NameValuePair&gt; param = new ArrayList&lt;NameValuePair&gt;(); param.add(new BasicNameValuePair("EmailID", strEmail)); param.add(new BasicNameValuePair("Password", strPassword)); UrlEncodedFormEntity ent = new UrlEncodedFormEntity(param, HTTP.UTF_8); post.setEntity(ent); HttpResponse responsePOST = client.execute(post); HttpEntity resEntity = responsePOST.getEntity(); if (resEntity != null) { Log.i("RESPONSE :::: ", EntityUtils.toString(resEntity)); } } catch (Exception e) { e.printStackTrace(); Log.i("ERROR ::: ", e.toString()); } return mStrings; } @Override protected void onProgressUpdate(Void... values) { super.onProgressUpdate(values); } @Override protected void onPostExecute(String[] result) { System.out.println("ProgressBar Dismiss"); super.onPostExecute(result); m_ProgressDialog.dismiss(); } } </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.
 

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