1

The error is "Bound mismatch: The type UserSettingsFragment is not a valid substitute for the bounded parameter of the type TabListener" and it occurs on the parametrizing of UserSettingsFragment.

public class MainActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedBundleInstance) {
        super.onCreate(savedBundleInstance);

        // Set up the action bar.
        final ActionBar actionBar = getActionBar();
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        Tab tab1 = actionBar.newTab().setText("One");


        tab1.setTabListener(new TabListener<UserSettingsFragment>(this, "UserSettingsFragment", UserSettingsFragment.class));

        actionBar.addTab(tab1); 
        //actionBar.addTab(settingsTab);
    }
}

Here are the relevant class signatures:

public class TabListener<T extends Fragment> implements ActionBar.TabListener {...}
private class FacebookFragment extends Fragment {...}
public class UserSettingsFragment extends FacebookFragment {...}

Note that FacebookFragment is package private in the Facebook SDK and therefore "not intended to be consumed by external applications." Is there some kind of rule that disallows parametrizing a subclass of the correct subclass(es) in this instance?

Thanks!

4

0 回答 0