MotionEvent getY - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for MotionEvent getY method.

This code example shows how to use the following methods:getAction, getPointerId, getPressure, getX, getY
	public void onClick(View view) {
	} 
 
	@Override 
	public boolean onDoubleTap(MotionEvent event) {
		final int action = event.getAction();
		final int pointerIndex = (action & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;
        final int pointerId = event.getPointerId(pointerIndex);
 
        OFAndroid.onTouchDoubleTap(pointerId, event.getX(pointerIndex), event.getY(pointerIndex), event.getPressure(pointerIndex));
 
		return true; 
		//return super.onDoubleTap(e); 
	} 
	 
	@Override 
	public boolean onDoubleTapEvent(MotionEvent event) {
		return super.onDoubleTapEvent(event);
	} 
 
10
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getAction, getX, getY
        // TODO Auto-generated constructor stub 
    } 
 
    @Override 
    public boolean onTouchEvent(MotionEvent event) {
        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
 
                int x = (int) event.getX();
                int y = (int) event.getY();
                x -= getTotalPaddingLeft();
                y -= getTotalPaddingTop();
                x += getScrollX();
                y += getScrollY();
 
                Layout layout = getLayout();
                int line = layout.getLineForVertical(y);
                int off = layout.getOffsetForHorizontal(line, x);
                Selection.setSelection(getText(), off);
                break; 
9
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getAction, getEventTime, getX, getY
    public boolean onTouchEvent(MotionEvent event) {
        if (DEBUG) {
            Slog.v(TAG, this + " onTouch: " + MotionEvent.actionToString(event.getAction()));
        } 
 
        final int action = event.getAction();
        if (action == MotionEvent.ACTION_OUTSIDE) {
            poke(event);
        } else if (action == MotionEvent.ACTION_DOWN) {
            if (DEBUG) {
                Slog.v(TAG, this + " ACTION_DOWN: " + event.getX() + "," + event.getY());
            } 
            int size = (int) getSize(event.getEventTime());
            if ((mVertical && event.getX() < size) || event.getY() < size) {
                if (CHATTY) {
                    Slog.v(TAG, "consuming errant click: (" + event.getX() + "," + event.getY() + ")");
                } 
                if (mShouldFlash) {
                    post(mDebugFlash);
                    postInvalidate();

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getEventTime, getPressure, getX, getY, obtain
 
    private void setContext(MotionEvent curr) {
        if (mCurrEvent != null) {
            mCurrEvent.recycle();
        } 
        mCurrEvent = MotionEvent.obtain(curr);
 
        mCurrLen = -1;
        mPrevLen = -1;
        mScaleFactor = -1;
 
        final MotionEvent prev = mPrevEvent;
 
        final float px0 = prev.getX(0);
        final float py0 = prev.getY(0);
        final float px1 = prev.getX(1);
        final float py1 = prev.getY(1);
        final float cx0 = curr.getX(0);
        final float cy0 = curr.getY(0);
        final float cx1 = curr.getX(1);

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getAction, getX, getY
		canvas.drawPath(path, paint);
	} 
 
	@Override 
	public boolean onTouchEvent(MotionEvent event) {
		int action = event.getAction();
		float x = event.getX();
		float y = event.getY();
		switch (action) {
		case MotionEvent.ACTION_DOWN:
			path.moveTo(x, y);
			break; 
		case MotionEvent.ACTION_MOVE:
			path.lineTo(x, y);
			invalidate();
			break; 
		default: 
			break; 
		} 
		return true; 
9
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getAction, getPointerCount, getX, getY
 
		return true; 
	} 
 
	final public boolean onTouchEvent(MotionEvent e) {
		final int action = e.getAction();
 
		// constants from APIv5: 
		// (action & ACTION_POINTER_INDEX_MASK) >> ACTION_POINTER_INDEX_SHIFT 
		final int pointer = (action & 0xff00) >> 8;
		 
		final int x0 = (int)e.getX();
		final int y0 = (int)e.getY();
		final int x1 = (e.getPointerCount() > 1 ? (int)e.getX(1) : -1);
		final int y1 = (e.getPointerCount() > 1 ? (int)e.getY(1) : -1);
		 
		if (pointer > 0) {
			_residualvm.pushEvent(JE_MULTI, pointer, action & 0xff, // ACTION_MASK
					x0, y0, x1, y1);
		} else { 
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getAction, getActionIndex, getActionMasked, getX, obtainNoHistory
    } 
 
    @Override 
    public boolean dispatchTouchEvent(MotionEvent ev) {
        if (mWallpaperConnection != null && mWallpaperConnection.mEngine != null) {
            MotionEvent dup = MotionEvent.obtainNoHistory(ev);
            try { 
                mWallpaperConnection.mEngine.dispatchPointer(dup);
            } catch (RemoteException e) {
            } 
        } 
         
        if (ev.getAction() == MotionEvent.ACTION_DOWN) {
            onUserInteraction();
        } 
        boolean handled = getWindow().superDispatchTouchEvent(ev);
        if (!handled) {
            handled = onTouchEvent(ev);
        } 
 

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getAction, getPointerId, getX, MotionEvent.getY
    @Override 
    public boolean onTouchEvent(MotionEvent ev) {
        mScaleDetector.onTouchEvent(ev);
 
        boolean ret = false;
        float x = ev.getX();
        float y = ev.getY();
 
        final int action = ev.getAction();
 
        switch (action & MotionEvent.ACTION_MASK) {
        case MotionEvent.ACTION_DOWN: {
            mRender.onActionDown(x, y);
            mActivePointerId = ev.getPointerId(0);
            ret = true;
            break; 
        } 
        case MotionEvent.ACTION_MOVE: {
            if (!mScaleDetector.isInProgress()) {
                mRender.onActionMove(x, y);

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getX, getY
    super.onDestroy(); 
  } 
 
  public boolean onTouch(View v, MotionEvent event) {
    Log.w("Tapjacker",
          String.valueOf(event.getX())+":"+String.valueOf(event.getY()));
     
    return(false); 
  } 
} 
9
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getEventTime, getPressure, getX, getY, obtain
 
	private void setContext(MotionEvent curr) {
		if (mCurrEvent != null) {
			mCurrEvent.recycle();
		} 
		mCurrEvent = MotionEvent.obtain(curr);
 
		mCurrLen = -1;
		mPrevLen = -1;
		mScaleFactor = -1;
 
		final MotionEvent prev = mPrevEvent;
 
		final float px0 = prev.getX(0);
		final float py0 = prev.getY(0);
		final float px1 = prev.getX(1);
		final float py1 = prev.getY(1);
		final float cx0 = curr.getX(0);
		final float cy0 = curr.getY(0);
		final float cx1 = curr.getX(1);

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related MotionEvent getY Questions & Answers:

Other MotionEvent getY Examples

38:	               GeoPoint geopoint = mapView.getProjection().fromPixels(
39:	                   (int) event.getX(),
40:	                   (int) event.getY());
41:	               // latitude
42:	               double lat = geopoint.getLatitudeE6() / 1E6;

Read More

23:	               GeoPoint geopoint = mapView.getProjection().fromPixels(
24:	                   (int) event.getX(),
25:	                   (int) event.getY());
26:	               // latitude
27:	               double lat = geopoint.getLatitudeE6() / 1E6;

Read More

getY Method Overview
Returns the Y coordinate of this event for the given pointer index (use getPointerId(int) to find the pointer identifier for this index).
See Code Examples for other Android MotionEvent Methods: