Here is the code I have. I'm getting a red line under new MainFragment();
with the error Type mismatch: cannot convert from WishlistFragment to Fragment
:
Fragment newfragment = new MainFragment();
Here is what my MainFragment.java file looks like:
public class MainFragment extends Fragment {
public MainFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
return inflater.inflate(R.layout.fragment_main, container, false);
}
}
Any ides on why this is happening? I have a feeling it's something stupid I am looking over and I am just code-blind right now from a long day.