我使用 SherlockFragmentActivity 并且我有:
public class TestActivity extends SherlockFragmentActivity {
private static enum Tab {
Test1("test1", TestOneFragment.class),
Test2("test2", TestTwoFragment.class),
private final String title;
private final Class<? extends Fragment> clazz;
private Tab(String title, Class<? extends Fragment> clazz) {
this.title = title;
this.clazz = clazz;
}
private String getTitle() {
return title;
}
private Class<? extends Fragment> getFragmentClass() {
return clazz;
}
}
它工作正常,因为我在同一个“包”中有 Test1 和 Test2。
如何添加外部“包”类?当我导入 com.bla.blaa.BlaActivity; 我这样使用:
private static enum Tab {
Blabla("Blabla", BlaActivity.class),
Test1("test1", TestOneFragment.class),
Test2("test2", TestTwoFragment.class);
我有错误:
The constructor TestActivity.Tab(String, Class<BlaActivity>) is
undefined