سؤال

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