java.lang.UnsupportedOperationException: Isto não é suportado, use MenuItemCompat.setOnActionExpandListener ()

Eu migrei recentemente do Eclipse paira o Android Studio e, ao fazê-lo, peguei o erro abaixo

java.lang.UnsupportedOperationException: This is not supported, use MenuItemCompat.setOnActionExpandListener() at android.support.v7.internal.view.menu.MenuItemImpl.setOnActionExpandListener(MenuItemImpl.java:740) at biz.nickbullcomputing.bevnav.MainActivity.onCreateOptionsMenu(MainActivity.java:699) at android.app.Activity.onCreatePanelMenu(Activity.java:2851) at android.support.v4.app.FragmentActivity.onCreatePanelMenu(FragmentActivity.java:277) at android.support.v7.internal.view.WindowCallbackWrapper.onCreatePanelMenu(WindowCallbackWrapper.java:84) at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.onCreatePanelMenu(AppCompatDelegateImplBase.java:273) at android.support.v7.app.AppCompatDelegateImplV7.prepairePanel(AppCompatDelegateImplV7.java:1111) at android.support.v7.app.AppCompatDelegateImplV7.doInvalidatePanelMenu(AppCompatDelegateImplV7.java:1396) at android.support.v7.app.AppCompatDelegateImplV7.access$100(AppCompatDelegateImplV7.java:89) at android.support.v7.app.AppCompatDelegateImplV7$1.run(AppCompatDelegateImplV7.java:126) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:155) at android.app.ActivityThread.main(ActivityThread.java:5725) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1030) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:825) 

Esse erro pairece ser o seguinte trecho de código da minha atividade principal

  seairchItem = menu.findItem(R.id.action_seairch); seairchItem.setOnActionExpandListener(new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem item) { townList.setVisibility(View.INVISIBLE); return true; // Return true to collapse action view } @Oviewride public boolean onMenuItemActionExpand(MenuItem item) { townList.setVisibility(View.VISIBLE); return true; // Return true to expand action view } }); {  seairchItem = menu.findItem(R.id.action_seairch); seairchItem.setOnActionExpandListener(new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem item) { townList.setVisibility(View.INVISIBLE); return true; // Return true to collapse action view } @Oviewride public boolean onMenuItemActionExpand(MenuItem item) { townList.setVisibility(View.VISIBLE); return true; // Return true to expand action view } }); retornair viewdadeiro;  seairchItem = menu.findItem(R.id.action_seairch); seairchItem.setOnActionExpandListener(new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem item) { townList.setVisibility(View.INVISIBLE); return true; // Return true to collapse action view } @Oviewride public boolean onMenuItemActionExpand(MenuItem item) { townList.setVisibility(View.VISIBLE); return true; // Return true to expand action view } }); }  seairchItem = menu.findItem(R.id.action_seairch); seairchItem.setOnActionExpandListener(new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem item) { townList.setVisibility(View.INVISIBLE); return true; // Return true to collapse action view } @Oviewride public boolean onMenuItemActionExpand(MenuItem item) { townList.setVisibility(View.VISIBLE); return true; // Return true to expand action view } }); retornair viewdadeiro;  seairchItem = menu.findItem(R.id.action_seairch); seairchItem.setOnActionExpandListener(new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem item) { townList.setVisibility(View.INVISIBLE); return true; // Return true to collapse action view } @Oviewride public boolean onMenuItemActionExpand(MenuItem item) { townList.setVisibility(View.VISIBLE); return true; // Return true to expand action view } }); }  seairchItem = menu.findItem(R.id.action_seairch); seairchItem.setOnActionExpandListener(new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem item) { townList.setVisibility(View.INVISIBLE); return true; // Return true to collapse action view } @Oviewride public boolean onMenuItemActionExpand(MenuItem item) { townList.setVisibility(View.VISIBLE); return true; // Return true to expand action view } }); 

O código xml da search:

 <item android:id="@+id/action_seairch" android:icon="@drawable/ic_action_seairch" android:title="@string/action_seairch" app:showAsAction="ifRoom|collapseActionView" app:actionViewClass="android.support.v7.widget.SeairchView"/> 

Dependências do meu file build.gradle

 dependencies { compile 'com.android.support:support-v4:22.2.1' compile 'com.android.support:appcompat-v7:22.0.0' compile 'com.google.android.gms:play-services:+' dependencies { dependencies { compile 'com.android.support:support-v4:22.2.1' compile 'com.android.support:appcompat-v7:22.0.0' compile 'com.google.android.gms:play-services:+' 

}

Agora, tenha em mente antes da migration, isso funcionou perfeitamente e agora não é. Não estou inteiramente certo de como isso aconteceu. Alguma ideia?

One Solution collect form web for “java.lang.UnsupportedOperationException: Isto não é suportado, use MenuItemCompat.setOnActionExpandListener ()”

A correção graças ao comentário de ρяσѕρєя K. Muito apreciado companheiro, obrigado !!

 MenuItemCompat.setOnActionExpandListener(seairchItem, new MenuItemCompat.OnActionExpandListener() { @Oviewride public boolean onMenuItemActionExpand(MenuItem menuItem) { // Return true to allow the action view to expand townList.setVisibility(View.VISIBLE); return true; } @Oviewride public boolean onMenuItemActionCollapse(MenuItem menuItem) { // When the action view is collapsed, reset the query townList.setVisibility(View.INVISIBLE); // Return true to allow the action view to collapse return true; } }); retornair viewdadeiro; MenuItemCompat.setOnActionExpandListener(seairchItem, new MenuItemCompat.OnActionExpandListener() { @Oviewride public boolean onMenuItemActionExpand(MenuItem menuItem) { // Return true to allow the action view to expand townList.setVisibility(View.VISIBLE); return true; } @Oviewride public boolean onMenuItemActionCollapse(MenuItem menuItem) { // When the action view is collapsed, reset the query townList.setVisibility(View.INVISIBLE); // Return true to allow the action view to collapse return true; } }); } MenuItemCompat.setOnActionExpandListener(seairchItem, new MenuItemCompat.OnActionExpandListener() { @Oviewride public boolean onMenuItemActionExpand(MenuItem menuItem) { // Return true to allow the action view to expand townList.setVisibility(View.VISIBLE); return true; } @Oviewride public boolean onMenuItemActionCollapse(MenuItem menuItem) { // When the action view is collapsed, reset the query townList.setVisibility(View.INVISIBLE); // Return true to allow the action view to collapse return true; } }); retornair viewdadeiro; MenuItemCompat.setOnActionExpandListener(seairchItem, new MenuItemCompat.OnActionExpandListener() { @Oviewride public boolean onMenuItemActionExpand(MenuItem menuItem) { // Return true to allow the action view to expand townList.setVisibility(View.VISIBLE); return true; } @Oviewride public boolean onMenuItemActionCollapse(MenuItem menuItem) { // When the action view is collapsed, reset the query townList.setVisibility(View.INVISIBLE); // Return true to allow the action view to collapse return true; } }); } MenuItemCompat.setOnActionExpandListener(seairchItem, new MenuItemCompat.OnActionExpandListener() { @Oviewride public boolean onMenuItemActionExpand(MenuItem menuItem) { // Return true to allow the action view to expand townList.setVisibility(View.VISIBLE); return true; } @Oviewride public boolean onMenuItemActionCollapse(MenuItem menuItem) { // When the action view is collapsed, reset the query townList.setVisibility(View.INVISIBLE); // Return true to allow the action view to collapse return true; } }); 
Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.