incompatible types: HomeFragment cannot be converted to Fragment in Android

后端 未结 9 1588
轻奢々
轻奢々 2020-12-01 15:57

I\'m getting an error in this part of code:

private void displayView(int position) {
    // update the main content by replacing fragments
    Fragment fragm         


        
9条回答
  •  有刺的猬
    2020-12-01 16:24

    use getSupportFragmentManager() Instead of getFragmentManager()

    getSupportFragmentManager()
        .beginTransaction()
        .replace(in.jama.app.R.id.container, new Fragment())
        .commit();
    

提交回复
热议问题