Skip to content Skip to sidebar Skip to footer

Not Able To Call Facebook Feature On Other Activitys

I am working with Facebook API using Android SDk. Here am facing one problem : If I reside in same Activity (Single Activity) I am able to use the features like 'Wall Post', 'App R

Solution 1:

You should not create new Facebook object for each activity. I recommend have a Utility class with static Facebook object which you initialize in your main activity and use this object though other activities.

E.g.

Class Utiltiy {
  publicstatic Facebook mFacebook;

  publicstaticvoidinitialize() {
      mFacebook = new Facebook(app_id);
  }
}

You call Utility.initialize() in your main activity's onCreate()

and wherever you need to make Facebook API call, you can use:

Utility.mFacebook.request(....).

Hope this is helpful.

Post a Comment for "Not Able To Call Facebook Feature On Other Activitys"