Android creates new process rather than returning to background activity
<p>I have a simple activity that starts and stops a background service that logs GPS data. I then place the process in the background by clicking on the home button. </p>

<p>When I return to the App by clicking on it's icon it creates a  new process rather than reverting to the original activity. If I then close this process (by clicking the back button) it calls onDestroy() and then reverts back to my original activity screen showing the service is still recording. This is very inconvenient for the intended use of the App. </p>

<p>It is my understanding the original activity should of been popped from the activity stack rather than a new process being created. </p>

<p>Included below is my activity code. I would appreciate anybody's explanation of this. </p>

<pre><code>public class MainActivity extends Activity {

    GPSTracker gps;
    private static final String TAG = "MEDIA";
    private String tv;
    private boolean record = false;
    private   TextView status = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        if (savedInstanceState != null) 
            record = savedInstanceState.getBoolean("Status");
        Toast.makeText(getApplicationContext(),"onCreate",Toast.LENGTH_LONG).show();

        setContentView(R.layout.activity_main);
    }

    public void StartRecord(View v) {
        Button btn = (Button) findViewById(R.id.record);
        status = (TextView) findViewById(R.id.status);

        if (record == false) {

            btn.setText("Stop Record");
            status.setText("... Recording ...");

            record = true;

            ComponentName comp = new ComponentName(getPackageName(), LogService.class.getName());
            ComponentName service = startService(new Intent().setComponent(comp));
        }
        else {
            record = false;
            status.setText("... Standing By ...");
            stopService(new Intent(MainActivity.this,LogService.class));
            btn.setText("Start Record");
        }

    }

    @Override
    public void onSaveInstanceState(Bundle savedInstanceState) {
        super.onSaveInstanceState(savedInstanceState);
        Toast.makeText(getApplicationContext(), "onSaveInstanceState",Toast.LENGTH_LONG).show();
        savedInstanceState.putBoolean("Status", record);
        // etc.
    }
    @Override
    public void onResume() {
        super.onResume();  // Always call the superclass method first
        Button btn = (Button) findViewById(R.id.record);
        Toast.makeText(getApplicationContext(), "onResume",Toast.LENGTH_LONG).show();
        if (record == true) 
            btn.setText("Stop Record");
        else

            btn.setText("Start Record");

    }

    @Override
    public void onStart() {
        super.onStart();  // Always call the superclass method first
        Toast.makeText(getApplicationContext(), "onStart",Toast.LENGTH_LONG).show();

    }

    @Override
    public void onRestart() {
        super.onRestart();  // Always call the superclass method first
        Toast.makeText(getApplicationContext(), "onRestart",Toast.LENGTH_LONG).show();

    }

    @Override
    public void onDestroy() {
        super.onDestroy();  // Always call the superclass method first
        Toast.makeText(getApplicationContext(), "onDestroy",Toast.LENGTH_LONG).show();

    }
    @Override
    public void onRestoreInstanceState(Bundle savedInstanceState) {
        super.onRestoreInstanceState(savedInstanceState);
        // Restore UI state from the savedInstanceState.
        // This bundle has also been passed to onCreate.
        Toast.makeText(getApplicationContext(), "onRestoreInstanceState",Toast.LENGTH_LONG).show();
        record = savedInstanceState.getBoolean("Status");
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
}
</code></pre>
