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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:23:40+00:00 2026-05-23T15:23:40+00:00

So i followed this tutorial to set up the android facebook sdk in my

  • 0

So i followed this tutorial to set up the android facebook sdk in my app i already have built. I now have all the files the tutorial says to build and everything shows no errors. Now i want to be able to set my app so that when the user presses a button on the app it brings them to the Facebook sign on page. I tried using this code but it doesnt work, the app crashes and i get these errors in logcat.

Can anyone help me get this to work?

ImageButton facebook= (ImageButton) findViewById(R.id.facebook);
        facebook.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                Intent myIntent = new Intent(view.getContext(), FBConnectionActivity.class);
                 startActivityForResult(myIntent, 0); 

            }
            });

And these are the errors logcat gives me:

07-10 22:10:57.510: ERROR/AndroidRuntime(819): FATAL EXCEPTION: main
07-10 22:10:57.510: ERROR/AndroidRuntime(819): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.outfit.first/com.outfit.first.FBConnectionActivity}: java.lang.InstantiationException: com.outfit.first.FBConnectionActivity
07-10 22:10:57.510: ERROR/AndroidRuntime(819):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1680)
07-10 22:10:57.510: ERROR/AndroidRuntime(819):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1784)
07-10 22:10:57.510: ERROR/AndroidRuntime(819):     at android.app.ActivityThread.access$1500(ActivityThread.java:123)
07-10 22:10:57.510: ERROR/AndroidRuntime(819):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:939)
07-10 22:10:57.510: ERROR/AndroidRuntime(819):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-10 22:10:57.510: ERROR/AndroidRuntime(819):     at android.os.Looper.loop(Looper.java:123)
07-10 22:10:57.510: ERROR/AndroidRuntime(819):     at android.app.ActivityThread.main(ActivityThread.java:3839)
07-10 22:10:57.510: ERROR/AndroidRuntime(819):     at java.lang.reflect.Method.invokeNative(Native Method)
07-10 22:10:57.510: ERROR/AndroidRuntime(819):     at java.lang.reflect.Method.invoke(Method.java:507)
07-10 22:10:57.510: ERROR/AndroidRuntime(819):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
07-10 22:10:57.510: ERROR/AndroidRuntime(819):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
07-10 22:10:57.510: ERROR/AndroidRuntime(819):     at dalvik.system.NativeStart.main(Native Method)
07-10 22:10:57.510: ERROR/AndroidRuntime(819): Caused by: java.lang.InstantiationException: com.outfit.first.FBConnectionActivity
07-10 22:10:57.510: ERROR/AndroidRuntime(819):     at java.lang.Class.newInstanceImpl(Native Method)
07-10 22:10:57.510: ERROR/AndroidRuntime(819):     at java.lang.Class.newInstance(Class.java:1409)
07-10 22:10:57.510: ERROR/AndroidRuntime(819):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
07-10 22:10:57.510: ERROR/AndroidRuntime(819):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1672)
  • 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-23T15:23:41+00:00Added an answer on May 23, 2026 at 3:23 pm

    Dont try and start an activity using the FBConnectionActivity, instead in the acivity you want them to login on extend the FBConnectionActivity
    eg:

    public class myActivity extends FBconnectionActivity{.......
    

    then in your onClickListener within myActivity(or whatever you’ve called it!) just call the setConnection() and getID() methods, this will then prompt the user to login via facebook. eg:

    ImageButton facebook= (ImageButton) findViewById(R.id.facebook);
    facebook.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            setConnection();
            getID();
        }
    });
    

    Note that this used a getID() method without the textView and progress bar that it in the tutorial, you can just add the following to you FBConnectionActivity class:

    public void getID() {
        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());
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just downloaded the android sdk from the adnroid site and followed this tutorial
I have followed this tutorial which allowed me to create a Silverlight DataGrid that
I've followed this tutorial: http://anandhansubbiah.com/blog/writing-your-first-android-application/ , but no matter what I do, and what
I have followed this tutorial by Scott pretty much to the T against my
I followed a tutorial to install Eclipse and the Android development files onto an
I followed this tutorial to localize my app: http://msdn.microsoft.com/en-us/library/ff637520%28v=vs.92%29.aspx#Y1210 So I created the class:
Ive followed this tutorial to install (multiple) solr instances on tomcat http://wiki.apache.org/solr/SolrTomcat Now i
Ok so I have followed this tutorial step by step: Custom Java Desktop Database
I have followed this tutorial about how to use the proximity alert and how
I followed the instructions in this tutorial to set up Zend AMF as a

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.