Note that there are some explanatory texts on larger screens.

plurals
  1. POAsyncTaskbackbutton
    primarykey
    data
    text
    <p>am able to sucessfully get data from the server.if data is success then am navigating NextScreen.1. if backbutton pressed when getting data then AsyncTask Dialog disappear, but after sometime it navigates to Nextscreen activity. so if i press backbuttob asyn task has to cancel and it should not navigate to next activity. </p> <pre><code> public class Screenone extends Activity { EditText user,pass; Button login; InputStream is; String productResponse; EditText edit; int responseCode; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.mainlog); user = (EditText) findViewById(R.id.user); pass = (EditText) findViewById(R.id.password); login = (Button) findViewById(R.id.login); } login.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if ((user.getText().length() &gt; 0) &amp;&amp; (pass.getText().length() &gt; 0) ) { new Load().execute(Status); } } }); } private class Load extends AsyncTask&lt;String, String, String&gt; { private ProgressDialog Dialog = new ProgressDialog(LoginScreen.this); protected void onPreExecute() { // TODO Auto-generated method stub super.onPreExecute(); Dialog.setMessage("Please wait..."); Dialog.show(); } protected String doInBackground(String... status) { try { HttpClient httpclient = new DefaultHttpClient(); HttpPost post = new HttpPost("---url---"); responseCode =httpResponse.getStatusLine().getStatusCode(); } catch (Exception e) { } return null; } protected void onPostExecute(String Result) { // TODO Auto-generated method stub super.onPostExecute(Result); if (responseCode==200) { Dialog.dismiss(); Intent intent =new Intent(Screenone.this, NextScreen.class); startActivity(intent); } } } public void onBackPressed() { // TODO Auto-generated method stub super.onBackPressed(); moveTaskToBack(true); } } </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.
 

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