Note that there are some explanatory texts on larger screens.

plurals
  1. POMultiple activity instances run?
    text
    copied!<p>I have 2 activities. In my first, i have a button and when i click on it, it start the second activity . But when i go back to my first and i click for second time my button, my second activity start but i have to go back two time to go back in my firts activity.</p> <p>If a click one again a will have to go back 3 time ... </p> <p>help me please. and thank you in advance :)</p> <p>this is my code:</p> <p>protected void onCreate(Bundle savedInstanceState) {</p> <pre><code> super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); this._that = this; _progressDialog = new ProgressDialog(this); EditText editText = (EditText) findViewById(R.id.MainActivityEditText); editText.setText("T_F81D4FA3F8"); Button button = (Button) findViewById(R.id.MainActivityButton); button.setOnClickListener(this); } @Override public void onClick(View v) { if(v.getId() == R.id.MainActivityButton ) { Log.w("MainActivity", "onClick"); _progressDialog.setMessage("Chargement en cours"); _progressDialog.show(); new Thread(new Runnable() { public void run() { EditText editText = (EditText) findViewById(R.id.MainActivityEditText); String s = editText.getText().toString().replace(" ", ""); Log.i("EditText", s); ID_APPLICATION = s; //if (! Datas.getInstance().isUpdateDatas()) WebService.getInstance().datas(_that); LocalBroadcastManager.getInstance(_that).registerReceiver(datasUpdateFail, new IntentFilter("datas-update-fail")); LocalBroadcastManager.getInstance(_that).registerReceiver(datasUpdate, new IntentFilter("datas-update")); } }).start(); } } BroadcastReceiver datasUpdate = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { myStartActivity("ACCUEIL"); _progressDialog.dismiss(); } }; BroadcastReceiver datasUpdateFail = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Toast.makeText(MainActivity.this, "Erreur : Veuillez verifier votre identifiant ou votre connexion", Toast.LENGTH_SHORT).show(); _progressDialog.dismiss(); } }; public void myStartActivity(String page){ Intent intent = new Intent(this, PageActivity.class); Bundle bundle = new Bundle(); bundle.putString("page", page); intent.putExtras(bundle); this.startActivity(intent); } </code></pre>
 

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