Returning to the Home Screen and then returning to last activity
<p>Having real issue understanding how to sort my issue out.</p>

<p>On the Home screen I have 2 buttons</p>

<p>When the user clicks the first button it starts a new Activity. What I am looking for is if the user clicks back the app returns to the home screen. If the user clicks the first button again it starts a new activity.</p>

<p>If the user clicks the second button it returns to the activity that was last started by clicking button 1</p>

<p>What I am having issue with is how to save the state of the activity when the user clicks back
Also how to call that activity when the second button is pressed</p>

<p>Thanks for your Time</p>

<p>UPDATE</p>

<p>I have gone down part of this but still having issues. If I put some of the code I am using perhaps someone can point where I gone wrong.</p>

<p>Code for calling the new activity from main menu</p>

<pre><code>Intent intent = new Intent(MainMenu.this, NewClass.class);
        intent.putExtra("value1", value1);  
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
</code></pre>

<p>Within the new class I have added the following :</p>

<pre><code>    @Override
public void onBackPressed() {
    //super.onBackPressed();
    Intent intent = new Intent(RoundScoring.this, MainMenu.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
    startActivity(intent);
    Toast.makeText(this, "Back Button Pressed", Toast.LENGTH_LONG).show();
}
</code></pre>

<p>I do not have either a onrestoreinstancestate or onresumne in this class. only a oncreate. Do I have to add something like this to bring back the instance</p>

<p>On the second button on the main menu I have added this</p>

<pre><code>Intent intentContiune = new Intent(MainMenu.this, NewClass.class);
            intentContiune.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
            startActivity(intentContiune);
</code></pre>

<p>Thanks</p>
