Android back problem
<p>in my project there are a few classes. Let's call them A, B, C, D.
I discovered 2 problems: e.g. i go from "A" class to "B" then to "C". In "B" class there is button and a counter. When i first push a btn in class "B", a counter is started and e.g. when the counter is at Number 6, class "C" opens. When i go back now from class "C" to class "B" (by clicking the back btn of my phone), counter is at Number 6, and not 0.</p>

<p>Second problem: I go from "A" to "B", then to "C" then back to "B" then to "C" and so on. When i push the back btn in class "C" i should go back to class "B" then to "A" then exit. But here is what happens: I go back to class "B" then i go back to class "C" then to class "B" then to class "A", so it goes back through all the classes that was opened before.</p>

<p>What's more, my exit button (<code>Main.this.finish();)</code> on the firworks only at the beginning. If i go through some classes, it behaves like the back button, making quitting the application impossible.</p>

<p>I don't if these problems are connected or not, but i would like to hear your opinions about them.</p>

<p>Thanks.</p>

<p><strong>Edit</strong>: I have read your comments and suggested webpages. I would like to be more specific now. For now, let's talk about three activites. Start.java, CustomizeDialog.java and Highscores.java. When user opens Start.java (by clicking a button in Main.java), a counter is started. Then after 3 seconds the user is automatically forwarded to CustomizeDialog.java to write his name. After clicking OK on that dialog, he is forwarded to HighScores.java. Now if he clicks the back button, he goes back to Start.java. Here the counter is at where it was left before (i know it is Android's behaviour).</p>

<p>So
Main -> Start -> CustomizeDialog -> Higshcores -> click back -> Start
(CustomizeDialog is not an activity, but a dialog this is why it is omitted when going back)</p>

<p>I tried this in the manifest, but does nothing:</p>

<pre><code>&lt;activity
    android:name=".Start"
    android:label="@string/app_name"
    android:finishOnTaskLaunch="true"&gt;
&lt;/activity&gt;
</code></pre>

<p>This is how i use the counter:</p>

<p>In a button listener in the onCreate method:</p>

<pre><code>counter = new MyCount(3000,1000);
if (started == false)
{
  counter.start();
  started = true;
}
</code></pre>

<p>Outside the onCreate method:</p>

<pre><code>public class MyCount extends CountDownTimer{
        public MyCount(long millisInFuture, long countDownInterval) {
        super(millisInFuture, countDownInterval);

        }

 public void onFinish() {
//filewrite
CustomizeDialog customizeDialog = new CustomizeDialog(Start.this);
        customizeDialog.show();
    };

 @Override
        public void onTick(long millisUntilFinished) {
        tv.setText("" + millisUntilFinished/1000);
    }
</code></pre>

<p>And OK button listener in CustomizeDialog:</p>

<pre><code>Intent intenthighscores = new Intent(mActivity, Highscores.class);
        mActivity.startActivity(intenthighscores);
//Activity mActivity; is declared at the beginning of the dialog
</code></pre>

<p>I removed the exit button as i read it is unnecessary, i will deal with it later as with the second problem, if that will still exist since it is related to the first problem.</p>
