// Place an ArticleFragment as our content pane final ArticleFragment f = new ArticleFragment(); getSupportFragmentManager().beginTransaction().add(android.R.id.content, f).commit();
This lines of code are from the NewsReader sample app
Why they are not working if the activity extends ActionBarActivity? Everything works fine if the activity extends FragmentActivity.
Update:
Not working means: The ArticleFragment don't becomes visible and it happens on devices with Android < 4.x, maybe < 3.x but I don't have a device with Android 3.x to test it.
Why?
Ralph
android.R.id.content does not work on Android 2.3 and below when using ActionBarActivity. There is a bug filed for this, though I am skeptical that it will get addressed. The only workaround I found was to call setContentView() with your own FrameLayout and use it as the target of your FragmentTransaction.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With