Issue
Explain me please, why IntelliJ IDEA shows me Parameter never used?
public void onClick(View view) { // Parameter 'view' never used
Toast.makeText(this, "Hello", Toast.LENGTH_LONG).show();
}
<ToggleButton
...
android:onClick="onClick"/>
But I know, if I delete this never used parameter (view), Android will throw me Runtime Exception.
Why IntelliJ IDEA v12.1 shows such warnings but Eclipse doesn't show. How to configure IntelliJ IDEA to hide such warnings for all Android projects?
Solution
You see this warning because the Unused symbol inspection is enabled by default and is configured to show any unused parameters as well. While it's not an issue in this specific case, it may help you to trace bugs in other cases (like when you are using a local variable with similar name because of the typo instead of the actual method parameter).
This inspection provides a lot of options and you can tune it for your needs, for example by disabling the Check Parameters option. Or you can define annotations like @Unused
so that IDE will ignore any parameters with these annotations, or you can just suppress this inspection from the Alt+Enter Menu, right arrow sub menu (suppress for class/method/statement, edit inspection settings or disable it completely).
Answered By - CrazyCoder
Answer Checked By - Cary Denson (JavaFixing Admin)