addPreferencesFromResource In Fragment Does Not Replace android.R.id.content Resulting In Blank View

Here’s the thing. When showing a preference view in a new Activity and loading the XML preference layout within a Fragment, the problem is when you call addPreferencesFromResource(), the Fragment shows a blank view.

No Exceptions, no warnings. Nada.

I have no idea why, but calling getSupportActionBar() solves this problem. Without calling the action bar method, android.R.id.content does not seem to exist hence replacing it with a Fragment will result in nothing since there is nothing to replace in the first place.

Related Posts Plugin for WordPress, Blogger...

Leave a Reply

Your email address will not be published. Required fields are marked *