touch In Dialog - Android User Interface

Android examples for User Interface:Dialog

Description

touch In Dialog

Demo Code


//package com.java2s;
import android.app.Activity;

import android.util.DisplayMetrics;

import android.view.MotionEvent;

public class Main {
    private static DisplayMetrics dm = null;

    public static boolean touchInDialog(Activity activity, MotionEvent e) {
        int leftW, rightW, topH, bottomH;

        leftW = 8; // (dm.widthPixels - 16) / 2;
        rightW = dm.widthPixels - leftW;
        topH = 0; // (dm.heightPixels - 80) / 2;
        bottomH = 450;//from  w ww .  j  a v  a 2s  . co  m
        // }
        return ((e.getX() > leftW) && (e.getX() < rightW)
                && (e.getY() > topH) && (e.getY() < bottomH));
    }
}

Related Tutorials