Unable to call finish() from a static handler
<p>I have a main activity that shecks if a user has logged into the service.  If no user has logged in, it opens a new activity:</p>

<pre><code>if (userName == null) {
    Intent myIntent = new Intent(MainActivity.this, Login.class);
    MainActivity.this.startActivity(myIntent);
}
</code></pre>

<p>This activity has fields for username and password and a login button.  The user fills in there information then clicks login.  I do the network all in a new thread:</p>

<pre><code>new Thread( new Runnable() {
    public void run() {
    try {                   
            Auth myAuth = new Auth(getApplicationContext());
    Boolean isAuth = false;
    isAuth=myAuth.getAuthToken(tUserName.getText().toString(), tPassword.getText().toString());
            Bundle b = new Bundle();
    b.putBoolean("isAuth", isAuth);
    Message msg = new Message();
    msg.setData(b);
    loginHandler.dispatchMessage(msg);
        }
        catch (InterruptedException ex) { ex.printStackTrace(); }
        catch (Exception ex) { ex.printStackTrace();}
        finally { }         }
    }).start();
</code></pre>

<p>This posts a message back to a handler:</p>

<pre><code>private static Handler loginHandler = new Handler () {
    @Override 
    public void handleMessage(Message msg) {
        mProgress.setVisibility(View.GONE);         

        if(msg.getData().getBoolean("isAuth")){
            // UNABLE TO CALL FINISH
        }
        else
        {
            CharSequence msg2 = "Login Failed";         
            Toast.makeText(context, msg2, Toast.LENGTH_SHORT).show();
        }
    }
};
</code></pre>

<p>I want to auto close the Login Activity if isAuth is true.</p>

<p>My plan for implemeting a login screen maybe going the wrong way.  Is so just let me know and I will look into another way that you suggest.</p>
