title: How to get rid of Suspicious call warning on Android Studio?
body: <p>In my code I have an <code>ArrayList&lt;Buttons&gt;</code> field named <code>mButtons</code>.
  Each of these buttons invoke (in XML) the same <code>onClick</code> function <code>onButtonClick</code>.
  The function looks like this:</p>
  
  <pre><code>public void onButtonClick(View view) {
      int buttonIndex = mButtons.indexOf(view);
  }
  </code></pre>
  
  <p>But Android Studio keeps warning me about a <code>Suspicious call to 'ArrayList.indexOf'</code>.</p>
  
  <p>Ok, I tried to get rid by casting <code>view</code> to <code>Button</code>.
  Then the warning changed to <code>Casting 'view' to 'Button' is redundant</code>.</p>
  
  <p>Well, I tried to change the function signature to receive a <code>Button</code> instead of a <code>View</code>.
  But now I have one warning on each <code>Button</code> declaration (XML): <code>Method 'onButtonClick' on '...Activity' has incorrect signature</code>.</p>
  
  <p>I'm really considering just add the <code>//noinspection SuspiciousMethodCalls</code> since it seems there's no workaround for it.</p>
  
  <p>I would appreciate if anyone knows how to get rid of it.</p>