绑定不匹配Java多态编译错误

时间:2014-01-27 20:43:07

标签: java generics

我有这个编译错误:

  

绑定不匹配:类型TabNotasFragment不是有效替代   对于该类型的有界参数<T extends Fragment>   MainActivity.TabListener<T>

以下是相关的代码:

public class TabNotasFragment extends Fragment {
    ......
}

.......

Tab tab = mActionBar.newTab()
                   .setText(R.string.TabNotas)
                   .setTabListener(new TabListener<TabNotasFragment>(
                               this, "notas", TabNotasFragment.class));
........


public static class TabListener<T extends Fragment> implements ActionBar.TabListener {
        private Fragment mFragment;
        private final Activity mActivity;
        private final String mTag;
        private final Class<T> mClass;


        public TabListener(Activity activity, String tag, Class<T> clz) {
            mActivity = activity;
            mTag = tag;
            mClass = clz;
        }
      ......
}

有什么想法吗?

0 个答案:

没有答案