Back button issues after forwarding intents via share menu
<p>I am working on a login screen for my application. If I open the application, by either running from eclipse or by selecting the application icon installed on the emulator, it will run an AuthUser.class which checks for a valid token on a remote server. If the user is not logged in then the AuthUser.class forwards to Login.class via...</p>

<pre><code>if (authtoken.length() == 0 || authtoken.length() &gt; 0
            &amp;&amp; checkAuthToken(authtoken) == false) {
        Intent intent = new Intent();
        intent.setClass(AuthUser.this, Login.class);
        startActivity(intent);
        finish();
    }
</code></pre>

<p>This works great, as when I use the back button on the emulator it will close the app rather than go back to the login screen. Perfect.</p>

<p>Now when I am coming from a share menu, like when I select share icon on an image within the gallery, and then select my application from the popup menu I also forward to the Login.class via...</p>

<pre><code>Intent intent1 = new Intent();
                intent1.setClass(SharePictureMenu.this, AuthUser.class);
                startActivity(intent1);
                finish();
</code></pre>

<p>Now when I login from here and it forwards to AuthUser.class as per usual, however, the back button press now takes me back to the login screen, even though I am forwarding and finishing exactly the same in both cases. Obviously I don't want that behavior as I want it to close the app and return to the gallery after login so the user can continue to share images immediately without having to go back through the login screen.</p>

<p>Any suggestions, hacks or otherwise on fixing this would be greatly appreciated.</p>
