Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4124354
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:43:48+00:00 2026-05-20T23:43:48+00:00

When i run a line of code to start an activity i get the

  • 0

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?

Error i get

My code to achieve this is…

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();
}

followed by the checkdatabase method…

public void checkdatabase(){


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


    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 

}

FacebookConnector Class

public class FacebookConnector {

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;
}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T23:43:49+00:00Added an answer on May 20, 2026 at 11:43 pm

    Your code is unclear, but if the top code is your “facebookConnector” class then each time you call login, you add the listener again, before recursively calling login again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've run across the following line in a VB6 application. mobjParentWrkBk.ExcelWorkBook.Application.Selection.Insert Shift:=xlToRight Unfortunately Google
How to run NAnt scripts in command line and get the timings of each
Is there some command line or AppleScript that I can write/run to make the
I know I can configure command line arguments in the Run configuration but I
I am wondering how to get a process run at the command line to
It looks like the run-time compiler doesn't support the same language as the command-line
I would like a command line function that I can run on any file
This problem is driving me crazy. I have the following code: 'unprotect sheet If.Range(Start).Row+1<.Range(End).Row
When I run the following code, I keep getting a glibc detected error when
I am trying to run a java based tool using a command line syntax

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.