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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:14:02+00:00 2026-06-12T09:14:02+00:00

I want to start a new activity when Facebook login completes that happens in

  • 0

I want to start a new activity when Facebook login completes that happens in a DialogListener. Login done successfully No error comes but activity doesn’t start. If you require logcat I can email you.
Following is my code.

Here is My HomeActivity

package com.example.faceb;

import com.facebook.android.AsyncFacebookRunner;
import com.facebook.android.Facebook;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

public class HomeActivity extends Activity implements OnClickListener{
    private static final String TAG = "Facebook";
    private Button mLogin, mLogout, mShare;
    private Facebook facebook;
    private AsyncFacebookRunner abRunner;

    public boolean flag;

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

        facebook = new Facebook("479652662068145");
        abRunner = new AsyncFacebookRunner(facebook);

        mLogin= (Button) findViewById(R.id.Login);
        mLogout= (Button) findViewById(R.id.Logout);

        mLogin.setOnClickListener(this);
        mLogout.setOnClickListener(this);     
    }

    @Override
    public void onClick(View v){
        int id = v.getId();
        switch(id){
            case R.id.Login:
                FacebookLoginDialog login = new FacebookLoginDialog(this);         
                facebook.authorize(this, login);
                if (func()==true)         
                {
                    Intent i = new Intent(this, SearchActivity.class);
                    startActivity(i);
                }
                break;
            case R.id.Logout:
                FacebookLogoutRequest logout = new FacebookLogoutRequest(this);
                abRunner.logout(this, logout);
                Toast toast = Toast.makeText(this, "You Are Logged Out", Toast.LENGTH_SHORT);
                toast.show();
                break;
            default:
                break;
        }
    }

    public static boolean func() {
        return true;
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_home, menu);
        return true;
    }
}

And Following my FacebookLoginDialog Class

public class FacebookLoginDialog implements DialogListener{
    @Override
    public void onComplete(Bundle values) {
        HomeActivity.func();
    }

    @Override
    public void onFacebookError(FacebookError e) {
        // TODO Auto-generated method stub
    }

    @Override
    public void onError(DialogError e) {
        // TODO Auto-generated method stub  
    }

    @Override
    public void onCancel() {
        // TODO Auto-generated method stub  
    }
}

This dialog starts on a button click which is in my HomeActivity. Please help I searched a lot and tried but unable to solve this issue.

  • 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-12T09:14:02+00:00Added an answer on June 12, 2026 at 9:14 am

    I think instead of starting the dialog on button click, u can start the activity, which u want to start after login. Then call the dialog inside the onCreate() of the new activity. So that u can just close the dialog in onComplete() and automatically the new screen will appear. Just keep a flag in the activity and set it to true only when the login succeeds. So that u can finish the new activity if the flag is false after the dialog get closed.

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

Sidebar

Related Questions

I want to start a new activity in non-Activity class that implements a DialogListener
i want to start a new activity from ab activity that (extends from Linearlayout)
I want that a new activity should start with some delay on pressing a
Normally, if I want to start a new activity I can use StartActivity(typeof(foo)); This
Suppose you want to start a new activity and pass it some data from
I want to clear the backstack when I start new Activity intent. The exact
I want to start a new activity intent in my current view! How i
I want to track new activity start , I use this code to only
Possible Duplicate: how to start a new activity when click on button I want
When you are about to start a new activity, and want to pass 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.