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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:00:32+00:00 2026-06-14T01:00:32+00:00

Below I have been trying to work with the Facebook SDK while i came

  • 0

Below I have been trying to work with the Facebook SDK while i came upon this problem, every time that a run the below code i seem to get the error “java.lang.IllegalStateException: Activity has been destroyed”, I think it has something to do with the fragments, any thoughts?

 11-02 15:24:29.212: E/AndroidRuntime(17034): FATAL EXCEPTION: main
 11-02 15:24:29.212: E/AndroidRuntime(17034): java.lang.RuntimeException: Unable to      start activity  ComponentInfo{com.example.facebooktest/com.example.facebooktest.FacebookTutorial}: java.lang.IllegalStateException: Activity has been destroyed

Above is the error, and below is the code.

package com.example.facebooktest;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.facebook.android.AsyncFacebookRunner;
import com.facebook.android.Facebook;

public class FacebookTutorial extends FragmentActivity {
    // --------- Facebook References ---------//
    private Fragment mainFragment;

    // application id from facebook.com/developers
    public static final String APP_ID = "434865303240706";
    // log tag for any log.x statements
    public static final String TAG = "FACEBOOK CONNECT";
    // permissions array
    private static final String[] PERMS = new String[] { "user_events" };
    // facebook vars
    private Facebook mFacebook;
    private AsyncFacebookRunner mAsyncRunner;
    // id text view
    private TextView mText;

    public static final int LOGIN = Menu.FIRST;
    public static final int GET_EVENTS = Menu.FIRST + 1;
    public static final int GET_ID = Menu.FIRST + 2;

    protected void initLayout() {
        LinearLayout rootView = new LinearLayout(this.getApplicationContext());
        rootView.setOrientation(LinearLayout.VERTICAL);

        this.mText = new TextView(this.getApplicationContext());
        this.mText.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT));
        rootView.addView(this.mText);

        this.setContentView(rootView);

    }

    // --------- Method called on create. ---------//

    public void onCreate(Bundle savedInstanceState) {

        if (savedInstanceState == null) {
            // Add the fragment on initial activity setup
            mainFragment = new Fragment();
            getSupportFragmentManager().beginTransaction()
                    .add(android.R.id.content, mainFragment).commit();
        } else {
            // Or set the fragment from restored state info
            mainFragment = (Fragment) getSupportFragmentManager()
                    .findFragmentById(android.R.id.content);
        }

    }

}
  • 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-14T01:00:33+00:00Added an answer on June 14, 2026 at 1:00 am

    Your onCreate is missing super.onCreate(savedInstanceState);, put it before the if statement and that should resolve the issue.

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    
        if (savedInstanceState == null) {
            // Add the fragment on initial activity setup
            mainFragment = new Fragment();
            getSupportFragmentManager().beginTransaction()
            .add(android.R.id.content, mainFragment).commit();
        } else {
            // Or set the fragment from restored state info
            mainFragment = (Fragment) getSupportFragmentManager()
                    .findFragmentById(android.R.id.content);
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good evening, I have been trying to wrap my head about this, below, code
I have spent hours trying to work this out, and spent a long time
I have been trying to get this query to work but I am stumbed
I have been trying all day to find a way to make this work.
I have been trying to get this to work for 12 hrs now and
I have been trying to understand how some of API methods work below is
In my example code below, you can see that I have been trying to
Hi I have been trying to work out the best way to do this
I have been trying everything I can to get this script to work and
I have been trying to access the below code DECLARE N_DEPTNO DEPT.DEPTNO %TYPE :=&DEPT_NUM;

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.