Question

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.

Était-ce utile?

La solution

Try wrapping your calculations with parenthesis, as seen below:

Log.i("IX GETX and GETY", " " + (f.getWidth()-iv.getWidth()) + " " + (f.getHeight()-iv.getHeight()));
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top