android multiple activities starting for no reason
<p>When i run a line of code to start an activity i get the following printout in the logcat and several of the same activity starting? can anyone help?</p>

<p><img src="http://i.stack.imgur.com/RwEYQ.png" alt="Error i get"></p>

<p>My code to achieve this is...</p>

<pre><code>public void login()
{
    System.out.println("1");
    SessionEvents.AuthListener listener = new SessionEvents.AuthListener()  {

        @Override
        public void onAuthSucceed() {
            facebookConnector.idnum();

            checkdatabase();

            if(id == ""){

            Intent i = new Intent(facebook.this, signup.class);
            startActivity(i);
            finish();
            }
            else{
                System.out.println("TEST");
                Intent i = new Intent(facebook.this, mainMenu.class);
                startActivity(i);
                finish();   

            }

        }

        @Override
        public void onAuthFail(String error) {
            System.out.println("2");

        }
    };
    System.out.println("3");
    SessionEvents.addAuthListener(listener);
    System.out.println("4");
    facebookConnector.login();
}
</code></pre>

<p>followed by the checkdatabase method...</p>

<pre><code>public void checkdatabase(){


    fbid = FacebookConnector.id;
    System.out.println("facebook id in check database = " + fbid);
    ArrayList&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;();


    nameValuePairs.add(new BasicNameValuePair("fbid",fbid));
    try{
        HttpClient httpclient = new DefaultHttpClient();


        HttpPost httppost = new HttpPost("checkdatabase.php");
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
        HttpResponse response = httpclient.execute(httppost);
        HttpEntity entity = response.getEntity(); 
        is = entity.getContent();
        System.out.println("---------");
        System.out.println(is);
    }catch(Exception e) 
    { 
    Log.e("log_tag", "Error in http connection "+e.toString()); 
    } 

    //convert response to string 
    try 
    { 
        System.out.println("WSSSSSSSSSSSSSS");
    BufferedReader reader = new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8); 
    System.out.println(reader + "TEST");
    StringBuilder sb = new StringBuilder(); 
    System.out.println("Wmmmmmmmmmmmmmmm");
    String line = null; 
    while ((line = reader.readLine()) != null)  
    { 
    sb.append(line + "\n"); 
    } 
    is.close(); 
    result=sb.toString(); 
    System.out.print("SAD");
    System.out.println(result + "READER");

    JSONArray jArray = new JSONArray(result); 
    JSONObject json_data = jArray.getJSONObject(1);


    id = json_data.getString("facebookid");
    System.out.println("facebooooooook id: " + fbid);
    System.out.println("database id: " + id);
    } 
    catch(Exception e) 
    {   
    Log.e("log_tag", "Error converting result "+e.toString()); 
    } 
    //parse json data 

}
</code></pre>

<p>FacebookConnector Class</p>

<p>public class FacebookConnector {</p>

<pre><code>private Facebook facebook = null;
private Context context;
private String[] permissions;
private Handler mHandler;
private Activity activity;
static String id;
private SessionListener mSessionListener = new SessionListener();;

public FacebookConnector(String appId,Activity activity,Context context,String[] permissions) {
    this.facebook = new Facebook(appId);
    id ="";

    SessionStore.restore(facebook, context);
    SessionEvents.addAuthListener(mSessionListener);
    SessionEvents.addLogoutListener(mSessionListener);

    this.context=context;
    this.permissions=permissions;
    this.mHandler = new Handler();
    this.activity=activity;
}

public void login() {
    System.out.println("5");
  //  if (!facebook.isSessionValid()) {
        facebook.authorize(this.activity, this.permissions,new LoginDialogListener());
   // }
}

public void logout() {
    System.out.println("33");
    SessionEvents.onLogoutBegin();
    AsyncFacebookRunner asyncRunner = new AsyncFacebookRunner(this.facebook);
    asyncRunner.logout(this.context, new LogoutRequestListener());
}
public void idnum(){
    try {
        JSONObject jObject = null;
        try {
            jObject = new JSONObject(facebook.request("me"));
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }    
        id =jObject.getString("id");

        System.out.println("facebook id: " + id);
    } catch (MalformedURLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

public void postMessageOnWall(String msg) {
    if (facebook.isSessionValid()) {
        Bundle parameters = new Bundle();
        parameters.putString("message", msg);
        try {
            String response = facebook.request("me/feed", parameters,"POST");
            System.out.println(response);
        } catch (IOException e) {
            e.printStackTrace();
        }
    } else {
        login();
    }
}   

private final class LoginDialogListener implements DialogListener {
    public void onComplete(Bundle values) {
        SessionEvents.onLoginSuccess();
    }

    public void onFacebookError(FacebookError error) {
        SessionEvents.onLoginError(error.getMessage());
    }

    public void onError(DialogError error) {
        SessionEvents.onLoginError(error.getMessage());
    }

    public void onCancel() {
        SessionEvents.onLoginError("Action Canceled");
    }
}

public class LogoutRequestListener extends BaseRequestListener {
    public void onComplete(String response, final Object state) {
        // callback should be run in the original thread, 
        // not the background thread
        mHandler.post(new Runnable() {
            public void run() {
                SessionEvents.onLogoutFinish();
            }
        });
    }
}

private class SessionListener implements AuthListener, LogoutListener {

    public void onAuthSucceed() {
        SessionStore.save(facebook, context);
    }

    public void onAuthFail(String error) {
    }

    public void onLogoutBegin() {           
    }

    public void onLogoutFinish() {
        SessionStore.clear(context);
    }
}

public Facebook getFacebook() {
    System.out.println("55");
    return this.facebook;
}
</code></pre>

<p>}</p>
