Incorrect warning in android studio
Android studio shows the warning "method setFoo is never used" in the following code:
public void setFoo(float foo) {
mFoo = foo;
invalidate();
}
protected void startFooProcess() {
ObjectAnimator animator = ObjectAnimator.ofFloat(this, "foo", 1.0f, 0.0f);
animator.setDuration(getResources().getInteger(android.R.integer.config_longAnimTime));
animator.setTarget(this);
animator.start();
}
But I am using it with an object animator, how do I suppress this kind of warning?
+3
source to share
2 answers
If you click on the method name setFoo
, you will get a yellow light bulb icon that you can click on the quick definition icons. As a shortcut with a caret in the method name, you can use the keyboard shortcut for Show Intent Actions, which is Alt + Enter in the default Mac keyboard.
Quick fix "Safely delete" setFoo (float) "" is not what you want, but you can expand it to see more options either from the keyboard or by pressing the right arrow. This shows the options you can use to disable validation. Screenshot:
+1
source to share