Issue
I have an android application with 2 screens. And I set a dialogue box while going from first screen to second screen. My code is:
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(MainActivity.this);
pDialog.setTitle("Please wait");
pDialog.setMessage("Authenticating User");
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
pDialog.setCanceledOnTouchOutside(false);
pDialog.show();
Intent it = new Intent(MainActivity.this, SecondActivity.class);
it.putExtra("invoiceid", invc);
it.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(it);
//finish();
}
When running code, On clicking the back button it shows the dialogue box and goes to the first screen. Now I want to show the first screen directly on clicking the back button without showing the dialogue box.How is it possible?
And how to clear the first screen if there is a text box in it ?
Solution
Try pDialog.dismiss()
before startActivity(it);
If you want to clear any data in any TextBox in the first Activity set text to that EditText "" before shifting any activity it will clear the data at EditText.
Answered By - Rakshit Nawani
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.