I\'m implementing a drag and drop for an Android application. In order to know if the drop happens inside the drop target, I need to know the bounding rectangle of the drop
You can also use a Rect here:
private boolean isViewContains(...) {
int[] l = new int[2];
imageView.getLocationOnScreen(l);
Rect rect = new Rect(l[0], l[1], l[0] + imageView.getWidth(), l[1] + imageView.getHeight());
return rect.contains(rx, ry);
}
Less wordy, and possibly faster, but certainly (IMO) more readable.