Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.graphics.Point;

import android.widget.RelativeLayout;

public class Main {
    public static boolean isPointInsideOption(Point balloonLocation, RelativeLayout optionLayout) {
        int[] optionLocation = new int[2];

        optionLayout.getLocationInWindow(optionLocation);

        int x = balloonLocation.x;
        int y = balloonLocation.y;

        int oX = optionLocation[0];
        int oY = optionLocation[1];

        if (y >= oY && y <= oY + optionLayout.getHeight() && x >= oX && x <= oX + optionLayout.getWidth()) {

            return true;

        } else
            return false;
    }
}