在类MainActivity,java中:

  public class MainActivity extends FragmentActivity implements
  LoaderManager.LoaderCallbacks<Cursor> {

public void onClickBtnDispNames(View view) {
    getSupportLoaderManager().initLoader(1, null, this);
}
}

有一个错误:
The method initLoader(int, Bundle, LoaderManager.LoaderCallbacks<D>) in the type LoaderManager is
 not applicable for the arguments (int, null, MainActivity)

最佳答案

确保从同一LoaderManager包中导入android.support.v4.*和相关类。

import android.support.v4.app.LoaderManager;
import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader;
...

关于java - 方法initLoader问题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26907671/

10-09 16:01