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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:31:36+00:00 2026-05-31T12:31:36+00:00

Currently I’m writing an adapter class to provide a convenient way for communication with

  • 0

Currently I’m writing an adapter class to provide a convenient way for communication with the facebook API.
The way I thought about using it is to run the authentication when the app is starting up, downloading user’s private picture, and later in the app publishing updates on users facebook wall using an AsyncFacebookRunner.

However flipping through the documentation it seems for every authorize() implementation the first parameter have to be an activity.

void authorize(Activity activity, final DialogListener listener):

And here I begin to wonder.

Thinking about activities and life cycles what will happen when the activity I threw in will be destroyed? Wouldn’t the reference for this object Facebook.mAuthActivity become invalid as well.
I see the logout() method “only” asks for a context.

String logout(Context context) throws …:
context – The Android context in which the logout should be called: it should be the same context in which the login occurred in order to clear any stored cookies

From what I see I can not guarantee the “login-activity” will still be present as app’s uptime increases – actually the opposite is more likely.

Are there any special situations I should consider to prevent the app form total crashing in a later state?

  • 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-31T12:31:37+00:00Added an answer on May 31, 2026 at 12:31 pm

    using facebook API for the android is easy and in your case you don’t need to save the Facebook instance the only thing you need is to save the authKey of the facebook on the first login then you can use it anywhere.
    this means that you can create more than one instance of the facebook object in mutiple activities based on the authKey.

    Otherwise you need to put this facebook object in a singleton handler to save it among the application :

    class x { 
         private Facebook obj;
         private static x instance;
         private x (){
         }
         public static x getX(){
              if(instance == null){
                    instance = new x();
              }
              return instance;
         }
    
         public void setIt(Facebook obj){
              this.obj = obj;
         }
         public Facebook getIt(){
               return obj;
         }
    }
    

    but this way is not the best way to implement the code you need to create a Facebook instance for each activity using the authKy.

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

Sidebar

Related Questions

Currently writing a C# application it should do backups using GIT in the background.
currently i'm using Omniauth-facebook and Koala to integrate with facebook, so posting status updates
Currently, I am writing a MiddleWare application that synchronizes information between and accounting application
Currently I am using HTML files for parts of my user interface. I display
currently, I`m implementing a map App with Mono4Droid and there I`m using a WebView
Currently I have 2 ways of displaying images in a cell, which way will
Currently, I have: <html> <div class=yes1><span><img src=img></span></div> </html> <script> var x = ='yes1' var
Currently I am adding object by creating it like: type TRecord = class private
Currently i'm having trouble using two functions in my -(void)viewDidLoad , both of these
Currently, my MVC 3 app has a dependency on a static class that is

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.