getLoaderManager()。initLoader(0,null,this);错误的第三个参数“ this”输入

时间:2018-10-24 15:41:08

标签: java android

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


public class CatalogActivity extends AppCompatActivity implements 
LoaderManager.LoaderCallbacks<Cursor> {

PetCursorAdapter mCursorAdapter;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_catalog);

    // Setup FAB to open EditorActivity
    FloatingActionButton fab =  findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent(CatalogActivity.this, EditorActivity.class);
            startActivity(intent);
        }
    });

    //Find the ListView which will be populated
    ListView petListView = findViewById(R.id.list_view);

    View emptyView = findViewById(R.id.empty_view);
    petListView.setEmptyView(emptyView);

    mCursorAdapter = new PetCursorAdapter(this, null);
    petListView.setAdapter(mCursorAdapter);

    //Kickoff loader
    getLoaderManager().initLoader(0, null, this);

}

显示第三个争论错误,我尝试将其强制转换为(android.app.LoaderManager.LoaderCallbacks),但仍然无法正常工作 建议此处一些类似错误的帖子建议更改导入文件,但我也尝试过这样做,但仍然相同

0 个答案:

没有答案