自定义加载器不工作。可能是一个简单的修复

Custom Loader isn't working. Probably an easy fix

我正在尝试制作一个自定义加载器,但它不起作用。这可能是一个简单的修复,我只是在这里放屁。

Class 加载:

public class Exercise{
...
}

加载程序:

public class ExerciseLoader extends AsyncTaskLoader<Exercise> {
...
}

片段:

public class DataFragment extends Fragment implements android.support.v4.app.LoaderManager.LoaderCallbacks<Exercise>{
...
@Override
public android.support.v4.content.Loader<Exercise> onCreateLoader(int id, Bundle args) {
    ExerciseLoader exerciseLoader = new ExerciseLoader(
        getActivity(),
        exerciseRowId
    );

    return exerciseLoader;
}

问题是它说 "return exerciseLoader" 有一个红线错误说

Incompatible Types

required android.support.v4.content.Loader.......com.MYPATH.Exercise

found com.MYPATH.ExerciseLoader

我不知道如何解决这个问题。

请检查您扩展的 AsyncTaskLoader<Exercise> 版本:android.content 包中的版本或 android.support.v4.content 中的版本。从您进一步的应用程序逻辑中,您需要使用支持库中的逻辑。