I have a Honeycomb style preferences. I define the headers:
I have found the solution. There is no way to access fragment directly, but it can be found via ListAdapter
. In your PreferenceActivity you can write:
int fragmentId = R.id.pref_sharing;
for (int i = 0; i < getListAdapter().getCount(); i++)
{
Header header = (Header) getListAdapter().getItem(i);
if (fragmentId == header.id)
{
// You can access a fragment name (class)
String fragment = header.fragment;
// You can access fragment arguments
Bundle args = header.fragmentArguments;
}
}
I didn't find a way to disable a header list item but I created a workaround based on this code.