I have the following code:

Log.i("IX GETX and GETY", " " + f.getWidth()-iv.getWidth() + " " + f.getHeight()-iv.getHeight());

I get the following error: The operator - is undefined for the argument type(s) String, int

Both the getWidth and getHeight have the same calculation.

有帮助吗?

解决方案

Try wrapping your calculations with parenthesis, as seen below:

Log.i("IX GETX and GETY", " " + (f.getWidth()-iv.getWidth()) + " " + (f.getHeight()-iv.getHeight()));
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top