Fragment using Appcompatactivity

Asked

Viewed 174 times

0

I’m getting this mistake:

onPrepareOptionsMenu Menu in android.support.v4.app.Fragment clashes with onPrepareOptions Menu Menu in android.app.Activity attemping to use incompatible Return type.

inserir a descrição do link aqui

inserir a descrição da imagem aqui

  • Please show the deployment of the onPrepareOptionsMenu method

  • When I Implement this Method this error appears getLoaderManager() in android.support.v4.app.Fragment clashes with getLoaderManager() in android.app.Activity attemptimg to use incompatible Return type.... even implementing @Override public void onPrepareOptionsMenu(Menu) { super.onPrepareOptionsMenu(menu); } is asked to place Return Boolean and when mute asks to place void appearing to be in conflict and that I am trying to implement a slidershow with Lib Androidimageslider inside a fragment that is inside a Navigation Drawer.

1 answer

0

It is difficult to help you without you posting the code. In the image you posted, your class is inheriting from Fragment and Appcompatactivity and this is not possible, because in Java there is no multiple inheritance. Set yourself the implementation of the error method so we can help you.

  • I posted another print I removed Appcompatactivity while doing this appears these errors ...the implementation onPrepareOptionsMenu worked out, was in doubt about that very.

  • @Leonardomarques constructors expect a context as a parameter. Where you have Homefragment.this you can change to getActivity() so it should work.

  • java has multiple inheritance yes but vc only does this with Interfaces

  • @Jasarorion

  • @Jasarorion actually, I don’t really know if implementing multiple interfaces can be considered heritage. According to this post http://www.programmerinterview.com/index.php/java-questions/multiple-inheritance/, inheritance is the ability to inherit from several classes and according to the post itself, no longer does this. But as you said: you can implement several interfaces.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.