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 6683323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:48:31+00:00 2026-05-26T04:48:31+00:00

How can i integrate GestureDetector with onItemLongClick? I have a GridView containing three images.

  • 0

How can i integrate GestureDetector with onItemLongClick?

I have a GridView containing three images. When I touch on the first image, I want to display a Toast message. When I lift up my finger from the screen, I want to display a second Toast message.

I know that GestureDetector uses MotionEvent, but onItemLongClick does not. But in this case, I would need to keep track of the image’s position ID in the grid, thus it is not possible to implement inside onTouch()?

  • 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-05-26T04:48:31+00:00Added an answer on May 26, 2026 at 4:48 am

    You can track the motion of the cursor, whether its a onscreen touch or a TrackBall move, using this class and if it crosses over into the next picture you can handle that event then. Here is an example taken from the sdk examples:

        @Override public boolean onTouchEvent(MotionEvent event) {
            int action = event.getActionMasked();
            if (action != MotionEvent.ACTION_UP && action != MotionEvent.ACTION_CANCEL) {
                int N = event.getHistorySize();
                int P = event.getPointerCount();
                for (int i = 0; i < N; i++) {
                    for (int j = 0; j < P; j++) {
                        mCurX = event.getHistoricalX(j, i);
                        mCurY = event.getHistoricalY(j, i);
                        drawPoint(mCurX, mCurY,
                                event.getHistoricalPressure(j, i),
                                event.getHistoricalTouchMajor(j, i));
                    }
                }
                for (int j = 0; j < P; j++) {
                    mCurX = event.getX(j);
                    mCurY = event.getY(j);
                    drawPoint(mCurX, mCurY, event.getPressure(j), event.getTouchMajor(j));
                }
            }
            return true;
        }
    

    You can read more and see the file in your SDK at C:\YourInstallDir\android-sdk\samples\android-10\ApiDemos\src\com\example\android\apis\graphics\TouchPaint.java or just search the whole examples files for MotionEvent there’s a few more uses in them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can we integrate a picture as a background image for a table.. <table>
How can I integrate word count into bassistance.de validation? For example, i dont want
I have downloaded Skype4COM from Skype so my question is, can i integrate it
I have an auto integrate trigger set up that can integrate between about 15
I want to know if i can integrate the paypal without using paypal library
I am looking for a free image gallery extension which I can integrate in
I'm looking for a custom disk image creation app that I can integrate into
I want to draw Area Chart in Coldfusion. I know we can integrate with
I'm aware that we can integrate in-app purchases with storekit. but i want to
I like to know how one can integrate the Qt libraries into an Enterprise

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.