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 6126053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:19:23+00:00 2026-05-23T16:19:23+00:00

I’m following a tutorial I found on this website http://www.helloandroid.com/tutorials/using-facebook-sdk-android-development-part-2 and when I inserted

  • 0

I’m following a tutorial I found on this website http://www.helloandroid.com/tutorials/using-facebook-sdk-android-development-part-2 and when I inserted the 2 sets of code segments in the classes the tutorial specifies I get 4 facebook sdk related errors. I inserted to the code segments bellow with the errors bold/starred.

Does anyone have any idea how I can fix these errors?

Here are the error messages i get when i mouse over the errors, in order:

1.onCreate(Bundle savedInstanceState) : The method onCreate(Bundle) of type main must override or implement a supertype method

  1. btnLogin.setOnClickListener(new OnClickListener() : OnClickListener cannot be resolved to a type

  2. LoginDialogListener : The type FBConnectionActivity.LoginDialogListener must implement the inherited abstract method Facebook.DialogListener.onComplete(Bundle)

  3. onComplete(Bundle values) : The method onComplete(Bundle) of type FBConnectionActivity.LoginDialogListener must override or implement a supertype method

Segment 1 (2 errors) :
In this part the errors are at the oncreate and the onclicklistener

  package com.outfit.first;

import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;

public class main extends FBConnectionActivity {
    private TextView txtUserName;
    private ProgressBar pbLogin;
    private Button btnLogin;

@Override
public void **onCreate(Bundle savedInstanceState)** {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    txtUserName = (TextView) findViewById(R.id.textFacebook);
    pbLogin = (ProgressBar) findViewById(R.id.progressLogin);
    btnLogin = (Button) findViewById(R.id.buttonLogin);
            btnLogin.setOnClickListener(new **OnClickListener**() {
                    @Override
                    public void onClick(View arg0) {
                            pbLogin.setVisibility(ProgressBar.VISIBLE);
                            setConnection();
                            getID(txtUserName, pbLogin);
                    }
            });
}
}

Segment 2 (2 errors): In this part the errors are at the LoginDialogListener class and the onComplete(Bundle values) inside that class.

package com.outfit.first;

import com.facebook.android.AsyncFacebookRunner;
import com.facebook.android.Facebook;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;
import android.widget.ProgressBar;
import android.widget.TextView;

public abstract class FBConnectionActivity extends Activity {
    public static final String TAG = "FACEBOOK";
    private Facebook mFacebook;
    public static final String APP_ID = "136907069717004";
    private AsyncFacebookRunner mAsyncRunner;
    private static final String[] PERMS = new String[] { "read_stream" };
    private SharedPreferences sharedPrefs;
    private Context mContext;

    private TextView username;
    private ProgressBar pb;

    public void setConnection() {
            mContext = this;
            mFacebook = new Facebook(APP_ID);
            mAsyncRunner = new AsyncFacebookRunner(mFacebook);
    }

    public void getID(TextView txtUserName, ProgressBar progbar) {
            username = txtUserName;
            pb = progbar;
            if (isSession()) {
                    Log.d(TAG, "sessionValid");
                    mAsyncRunner.**request**("me", new IDRequestListener());
            } else {
                    // no logged in, so relogin
                    Log.d(TAG, "sessionNOTValid, relogin");
                    mFacebook.**authorize**(this, PERMS, new LoginDialogListener());
            }
    }

    public boolean isSession() {
            sharedPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
            String access_token = sharedPrefs.getString("access_token", "x");
            Long expires = sharedPrefs.getLong("access_expires", -1);
            Log.d(TAG, access_token);

            if (access_token != null && expires != -1) {
                    mFacebook.setAccessToken(access_token);
                    mFacebook.setAccessExpires(expires);
            }
            return mFacebook.isSessionValid();
    }

    private class **LoginDialogListener** implements DialogListener {

            @Override
            public void **onComplete(Bundle values)** {
                    Log.d(TAG, "LoginONComplete");
                    String token = mFacebook.getAccessToken();
                    long token_expires = mFacebook.getAccessExpires();
                    Log.d(TAG, "AccessToken: " + token);
                    Log.d(TAG, "AccessExpires: " + token_expires);
                    sharedPrefs = PreferenceManager
                                    .getDefaultSharedPreferences(mContext);
                    sharedPrefs.edit().putLong("access_expires", token_expires)
                                    .commit();
                    sharedPrefs.edit().putString("access_token", token).commit();
                    mAsyncRunner.request("me", new IDRequestListener());
            }

            @Override
            public void onFacebookError(FacebookError e) {
                    Log.d(TAG, "FacebookError: " + e.getMessage());
            }

            @Override
            public void onError(DialogError e) {
                    Log.d(TAG, "Error: " + e.getMessage());
            }

            @Override
            public void onCancel() {
                    Log.d(TAG, "OnCancel");
            }
    }

    private class IDRequestListener implements RequestListener {

            @Override
            public void onComplete(String response, Object state) {
                    try {
                            Log.d(TAG, "IDRequestONComplete";);
                            Log.d(TAG, "Response: " + response.toString());
                            JSONObject json = Util.parseJson(response);

                            final String id = json.getString("id");
                            final String name = json.getString("name");
                            FBConnectionActivity.this.runOnUiThread(new Runnable() {
                                    public void run() {
                                            username.setText("Welcome: " + name+"\n ID: "+id);
                                            pb.setVisibility(ProgressBar.GONE);

                                    }
                            });
                    } catch (JSONException e) {
                            Log.d(TAG, "JSONException: " + e.getMessage());
                    } catch (FacebookError e) {
                            Log.d(TAG, "FacebookError: " + e.getMessage());
                    }
            }

            @Override
            public void onIOException(IOException e, Object state) {
                    Log.d(TAG, "IOException: " + e.getMessage());
            }

            @Override
            public void onFileNotFoundException(FileNotFoundException e,
                            Object state) {
                    Log.d(TAG, "FileNotFoundException: " + e.getMessage());
            }

            @Override
            public void onMalformedURLException(MalformedURLException e,
                            Object state) {
                    Log.d(TAG, "MalformedURLException: " + e.getMessage());
            }

            @Override
            public void onFacebookError(FacebookError e, Object state) {
                    Log.d(TAG, "FacebookError: " + e.getMessage());
            }

    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            mFacebook.authorizeCallback(requestCode, resultCode, data);
    }
}
  • 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-23T16:19:24+00:00Added an answer on May 23, 2026 at 4:19 pm

    Ctrl-Shift-o and everything should work(it does for me atleast)

    Imports needed for first activity:

    import android.app.Activity;
    import android.os.Bundle;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.Button;
    import android.widget.ProgressBar;
    import android.widget.TextView;
    

    And for the second :

    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.net.MalformedURLException;
    
    import org.json.JSONException;
    import org.json.JSONObject;
    
    import android.app.Activity;
    import android.content.Context;
    import android.content.Intent;
    import android.content.SharedPreferences;
    import android.os.Bundle;
    import android.preference.PreferenceManager;
    import android.util.Log;
    import android.widget.ProgressBar;
    import android.widget.TextView;
    
    import com.facebook.android.AsyncFacebookRunner;
    import com.facebook.android.AsyncFacebookRunner.RequestListener;
    import com.facebook.android.DialogError;
    import com.facebook.android.Facebook;
    import com.facebook.android.Facebook.DialogListener;
    import com.facebook.android.FacebookError;
    import com.facebook.android.Util;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
this is what i have right now Drawing an RSS feed into the php,
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.