• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Android App "froze" w/Facebook Login MainFragment

blitzJan

Lurker
Feb 25, 2013
4
0
I setup FB Login into an Activity and also created a class MainFragment.java which follows FB's tuturial perfectly. Found here: https://developers.facebook.com/docs/howtos/androidsdk/3.0/login-with-facebook/

The login works well, but the App is stuck in the Fragment and therefore the rest of my App is not responding. Probably a simple fix. Wondering what I missed to add to ensure the remaining codes still executes? Here is my code added for the FB Login from my MainActivity class:

public class MainActivity extends FragmentActivity {

private MainFragment mainFragment;

Code:
@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		if (savedInstanceState == null) {
	        // Add the fragment on initial activity setup
	        mainFragment = new MainFragment();
	        getSupportFragmentManager()
	        .beginTransaction()
	        .add(android.R.id.content, mainFragment)
	        .commit();
	    } else {
	        // Or set the fragment from restored state info
	        mainFragment = (MainFragment) getSupportFragmentManager()
	        .findFragmentById(android.R.id.content);
	    }
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones