Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.view.MotionEvent;
import android.view.View;

public class Main {

    public static boolean isEventInView(MotionEvent ev, View view) {
        int[] location = new int[2];
        view.getLocationInWindow(location);
        if (ev.getX() > location[0] && ev.getX() < location[0] + view.getWidth() && ev.getY() > location[1]
                && ev.getY() < location[1] + view.getHeight()) {

            return true;
        }
        return false;
    }
}