我有以下代码...
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
...
public class LevelSelectorFragmentActivity extends FragmentActivity {
...
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_level);
this.mAdapter = new LevelFragmentPagerAdapter(this);
}
private static class LevelFragmentPagerAdapter extends FragmentPagerAdapter {
public LevelFragmentPagerAdapter(FragmentActivity a) {
super(a.getSupportFragmentManager());
}
@Override
public Fragment getItem(int position) {
return Level1Fragment.newInstance();
}
@Override
public int getCount() {
return NUMBER_OF_PAGES;
}
}
}
这工作正常,但是当我将表单 FragmentActivity 更改为 Activity 并将导入更改如下...
导入 org.gleason.superhockey.fragment.Level1Fragment;
import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.support.v13.app.FragmentPagerAdapter;
public class LevelSelectorFragmentActivity extends Activity {
private static final int NUMBER_OF_PAGES = 2;
private LevelFragmentPagerAdapter mAdapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_level);
this.mAdapter = new LevelFragmentPagerAdapter(this);
}
private static class LevelFragmentPagerAdapter extends FragmentPagerAdapter {
public LevelFragmentPagerAdapter(Activity a) {
super(a.getFragmentManager());
}
@Override
public Fragment getItem(int position) {
return Level1Fragment.newInstance();
}
@Override
public int getCount() {
return NUMBER_OF_PAGES;
}
}
}
我得到以下 ClassNotFound ...
java.lang.NoClassDefFoundError: org.gleason.superhockey.LevelSelectorFragmentActivity$LevelFragmentPagerAdapter
例如,我正在使用这个
谁能看到我错过了什么?