[英]Android Class marked as never used
I have a really easy class (ColorTool.java):我有一个非常简单的类(ColorTool.java):
import android.graphics.Color;
public class ColorTool {
public boolean closeMatch (int color1, int color2, int tolerance) {
if (Math.abs (Color.red (color1) - Color.red (color2)) > tolerance ) return false;
if (Math.abs (Color.green (color1) - Color.green (color2)) > tolerance ) return false;
return Math.abs(Color.blue(color1) - Color.blue(color2)) <= tolerance;
}
}
And I'm using it in the Main class:我在 Main 类中使用它:
private final ColorTool ct = new ColorTool ();
And using it:并使用它:
int tolerance = 25;
switch (action) {
case MotionEvent.ACTION_DOWN :
break;
case MotionEvent.ACTION_UP :
v.performClick();
int touchColor = getHotspotColor (R.id.imgMainAreas, evX, evY);
if(x == 1){
if (ct.closeMatch (Color.BLUE, touchColor, tolerance)){
x = 2;
animStart();
}
}
...
Anyway, the Class is marked as never used, the function within too.无论如何,该类被标记为从未使用过,其中的函数也是如此。 (closeMatch) When I analyze the whole code of the App this happens too.
(closeMatch) 当我分析应用程序的整个代码时,也会发生这种情况。 Maybe I forgive something?
也许我原谅了什么? I updated to latest Android Studio version.
我更新到最新的 Android Studio 版本。
在不同的地方可能有两个同名的类,而 Main 使用另一个。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.