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

  • SEARCH
  • Home
  • 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 8010253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:40:52+00:00 2026-06-04T18:40:52+00:00

I am using facebook connect in my android app. It is basically a form.

  • 0

I am using facebook connect in my android app. It is basically a form. There is a facebook login button on the page. I want the information on the form to be filled in when thee user logs in using Facebook login.

I am trying the following code:

public void loginFB()  {
    facebook.authorize(this, new String[] { "email", "read_stream" }, new DialogListener() {                
        @Override
        public void onComplete(Bundle values) {}

        @Override
        public void onFacebookError(FacebookError error) {}

        @Override
        public void onError(DialogError e) {}

        @Override
        public void onCancel() {}
    });

    getlogininfo();
}                 

public void getlogininfo(){
    mAsyncRunner.request("me", new RequestListener(){
        @Override
        public void onComplete(String response, Object state) {
            try{
                Log.d("Profile", response.toString());
                JSONObject json = Util.parseJson(response);
                final String fname1 = json.getString("first_name");
                final String lname1 = json.getString("last_name");
                    final String email = json.getString("email");
                    MintPaymentsActivity.this.runOnUiThread(new Runnable(){
                        public void run() {
                            fname.setText(fname1);
                            lname.setText(lname1);
                            emailadd.setText(email);
                        }
                    });
                }
                catch(JSONException e){
                    Log.w("This", "eror");
                }
            }

            @Override
            public void onIOException(IOException e, Object state) {
                // TODO Auto-generated method stub
            }
            @Override
            public void onFileNotFoundException(FileNotFoundException e, Object state) {
                // TODO Auto-generated method stub
            }

            @Override
            public void onMalformedURLException(MalformedURLException e, Object state) {
                // TODO Auto-generated method stub
            }

            @Override
            public void onFacebookError(FacebookError e, Object state) {
                // TODO Auto-generated method stub
            }
        });
}

/*FB --- */
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    facebook.authorizeCallback(requestCode, resultCode, data);
}

basically, when the user clicks the button, faceboook asks for login and then collects the JSON data to display the name and email of the logged in user.

It gives me the following error:

05-30 21:52:40.598: E/AndroidRuntime(665): FATAL EXCEPTION: Thread-13
05-30 21:52:40.598: E/AndroidRuntime(665): com.facebook.android.FacebookError: An active access token must be used to query information about the current user.
05-30 21:52:40.598: E/AndroidRuntime(665):  at com.facebook.android.Util.parseJson(Util.java:279)
05-30 21:52:40.598: E/AndroidRuntime(665):  at com.Myapp.Myapp$2.onComplete(Myapp.java:117)
05-30 21:52:40.598: E/AndroidRuntime(665):  at com.facebook.android.AsyncFacebookRunner$2.run(AsyncFacebookRunner.java:254)

When I put an extra button to fill in the details, so that the getlogininfo() is implemented on a button click (after logging in) it works fine. But i want it to be filled in as soon as the user clicks the facebook login button.

  • 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-06-04T18:40:53+00:00Added an answer on June 4, 2026 at 6:40 pm

    It should be:

    public void loginFB() {
        facebook.authorize(this, new String[] { "email", "read_stream" }, new DialogListener() {                
            @Override
            public void onComplete(Bundle values) {
                this.getlogininfo();
            }
    
            @Override
            public void onFacebookError(FacebookError error) {}
    
            @Override
            public void onError(DialogError e) {}
    
            @Override
            public void onCancel() {}
        });
    }
    

    You want to execute getLogininfo only after the authentication has completed.
    Also, I suggest that you handle the errors as well, at least log it so you’ll know when developing.

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

Sidebar

Related Questions

I want to make a simple Android app which connect to facebook, but i'му
Implementing a PhoneGap app for Android and iOS, the app is using Facebook Connect
I am using Facebook Connect for sharing something on my appliction. So I want
I am using Facebook Connect with my app. Everything is set up, all the
I am using Facebook Connect . When I click on the Log In button
I have a facebook connect site using the c# facebook toolkit. I want to
I am using fb-connect for android app problem is when keyboards gets open layout
I am using the Android code below to connect to Facebook but getting the
I'm using facebook connect to allow the visitors login to a website using their
I want to upload a foto from my android app to a facebook fan

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.