9

When using the greenrobot EventBus library, all @Subscribe-annotated methods are displayed in light grey with a warning Method onMyEvent() is never used in Android Studio.

Is there a way to automatically suppress this warning (as the method is not directly called from code, but in response to an event on the event bus)?

friederbluemle
  • 33,549
  • 14
  • 108
  • 109

1 Answers1

25

You can turn it off by pointing to left of the light greyed code.

Then after bulb icon appear, click and select 'Suppress method annotated by org.greenrobot...'


UPDATE

Found new working plugin for EventBus 3 IntelliJ at eventbus3-intellij-plugin. This is a working fork of Shinnosuke Kugimiya eventbus3-intellij-plugin.

Working with Android Studio 2.1.3.

Community
  • 1
  • 1
ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96
  • Thanks, that works! Is there a way to make this the default for a fresh clone via the build system or other config file, **without** committing IDE files (.idea/) to source control? – friederbluemle Jun 27 '16 at 06:07
  • I don't know if there is another ways. But recently I found that there is a plugin for @Subscribe EventBus at [Intellij Plugin for nagivation](https://github.com/greenrobot/EventBus/issues/84). Haven't try. If you've try it, please inform me..:D – ישו אוהב אותך Jun 27 '16 at 06:16
  • @friederbluemle: Found a working plugin for EventBus!. Please read my updated answer ;) – ישו אוהב אותך Sep 08 '16 at 05:11
  • Hi , how u fixed this issue ? – Erum Jan 01 '20 at 08:22