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

  • Home
  • SEARCH
  • 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 8573495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:15:50+00:00 2026-06-11T19:15:50+00:00

I am working on a simple android app, my Requirement is, After some move

  • 0

I am working on a simple android app, my Requirement is,

“After some move events(MotionEvent.ACTION_MOVE is true) on the screen, if the user stops moving for few seconds some where with out taking finger from the screen, then need to perform some action.”

*I learnt that LongPress is something which triggers when user doesn’t make any move after the down event is triggered(MotionEvent.ACTION_DOWN).*

So is there any way to trigger LongPress after Moving around in the screen?

Or should I create my own listener for the same functionality??

Any help is appreciated.

Thank you.

  • 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-11T19:15:51+00:00Added an answer on June 11, 2026 at 7:15 pm

    Idea is to cancel the timer everytime you move finger on screen(MotionEvent.ACTION_MOVE). When you stop moving after some time, say after 3 seconds, timer code will get executed, in which you can do long press task. If you stop moving for some time and again start moving before elapse time (3 sec), again new timer is set and so on. Hope it helps you.

    timer = new Timer();
    
    public boolean onTouchEvent(MotionEvent event) 
    {
        switch(event.getAction()) 
        {
            case MotionEvent.ACTION_DOWN:
                 break;
    
            case MotionEvent.ACTION_MOVE:
                 timer.cancel();
                 timer = null;
                 timer = new Timer();
                 timer.schedule(new TimerTask() 
                 {                  
                    @Override
                    public void run() {
                        // do your long press task here
                    }
                 }, 3000);
                 break;
    
            case MotionEvent.ACTION_UP:
                 timer.cancel();
                 timer = null;
                 break;
        }
        return super.onTouchEvent(event);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a relatively simple Android app. I want it to have an
I'm new to android game development. I currently working on a simple android app
I'm working on a relatively simple Android app. I want it to have an
I am working on an android app in which I am seeing some disparity
I'm working on a simple android app in which I want to, once the
Currently i am working in simple android app, I have tried to range of
hi working with simple android application that shows address of the user but this
I am developing a simple Android app and am getting a 'App stopped working'
I've been working on a simple app for android - and i'm trying to
Working on a simple TimeTracker App. You start a timer, wait a certain time,

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.