Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8384351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:23:10+00:00 2026-06-09T17:23:10+00:00

I’m working on an application (on a Galaxy Nexus), and I noticed that Google

  • 0

I’m working on an application (on a Galaxy Nexus), and I noticed that Google implemented the “Google Now” application when you swipe from the bottom of the bezel onto the screen (the chrome browser also did this for a while, not sure if it still does). I’ve been looking around but have been unable to determine how they accomplished this. Is there an easy way to handle gestures that begin in the bezel rather than on the screen?

I checked the developer pages for reference, but the only article I could find was here:

http://developer.android.com/design/patterns/gestures.html

Is there anywhere else where this information would be available?

[Edit]

I’ve been trying very unsuccessfully to get edge gestures working based on Lain_B’s method, but cannot make it work. Here’s the code that I’m using to try and detect the gestures, but logcat is always outputting a zero…

public class MainActivity extends Activity implements OnGestureListener {

private GestureDetector myGesture;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    myGesture = new GestureDetector(getBaseContext(),
            (OnGestureListener) this);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.activity_main, menu);
    return true;
}

@Override
public boolean onTouchEvent(MotionEvent event) {
    Log.e("Flags Touch", "Flags: " + event.getEdgeFlags());
    return myGesture.onTouchEvent(event);
}

@Override
public boolean onDown(MotionEvent e) {
    Log.e("Flags", "Flags: " + e.getEdgeFlags());
    Log.e("Event", "onDown");
    // TODO Auto-generated method stub
    return false;
}

@Override
public void onLongPress(MotionEvent e) {
    Log.e("Event", "onLongPress");
    // TODO Auto-generated method stub

}

@Override
public void onShowPress(MotionEvent e) {
    Log.e("Flags", "Flags: " + e.getEdgeFlags());
    Log.e("Event", "onShowPress");
    // TODO Auto-generated method stub

}

@Override
public boolean onSingleTapUp(MotionEvent e) {
    Log.e("Event", "onSingleTapUp");
    // TODO Auto-generated method stub
    return false;
}

@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,
        float distanceY) {
    // Log.e("Event", "onScroll");
    return false;
}

// these constants are used for onFling
private static final int SWIPE_MIN_DISTANCE = 120;
private static final int SWIPE_MAX_OFF_PATH = 250;
private static final int SWIPE_THRESHOLD_VELOCITY = 200;

@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
        float velocityY) {

    Log.e("Event", "onFling");
    Log.e("Flags", "Flags: " + e1.getEdgeFlags());

    if (e1.getEdgeFlags() == MotionEvent.EDGE_LEFT) {
        // code to handle swipe from left edge
        Log.e("!!!!!", "Edge fling!");
    }

    try {
        // do not do anything if the swipe does not reach a certain length
        // of distance
        if (Math.abs(e1.getY() - e2.getY()) > SWIPE_MAX_OFF_PATH)
            return false;

        // right to left swipe
        if (e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE
                && Math.abs(velocityX) < SWIPE_THRESHOLD_VELOCITY) {

        }
        // left to right swipe
        else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE
                && Math.abs(velocityX) < SWIPE_THRESHOLD_VELOCITY) {

        }
    } catch (Exception e) {
        // nothing
    }
    return false;

}
}

[Edit 2]

With Lain_B’s requested output…

(Using Nexus 7)… Starting from farthest possible left point on the bezel, and swiping right to the middle(ish).

08-16 16:44:13.674: I/Fling(16702): Flags: 0
08-16 16:44:13.674: I/Fling(16702): e1: 2.5 711.5152
08-16 16:44:13.674: I/Fling(16702): e2: 215.4591 717.08105

Swiping from the center point of the screen, off the screen (to the right side)

08-16 16:46:37.364: I/Fling(16702): Flags: 0
08-16 16:46:37.364: I/Fling(16702): e1: 392.5 758.1818
08-16 16:46:37.364: I/Fling(16702): e2: 783.4375 743.3334
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:23:10+00:00Added an answer on June 9, 2026 at 5:23 pm

    I think MotionEvent.getEdgeFlags() is what you’re looking for. You can then compare the returned value with EDGE_LEFT , EDGE_RIGHT , etc to see which edge was touched.

    if( event1.getEdgeFlags()&MotionEvent.EDGE_LEFT != 0 ){
        //code to handle swipe from left edge
    }
    

    or

    if( e1.getX() < 5.0f ){
        //handle swipe from left edge
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.