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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:24:21+00:00 2026-06-17T23:24:21+00:00

I am trying to develop a musical instrument app in android. I implemented OnTouchListener

  • 0

I am trying to develop a musical instrument app in android. I implemented OnTouchListener for every button, and there is no problem when I just touch one button. But when I touch a button and move my finger to the next one, the OnTouchListener for that button is not called and its sound not playing. How can I manage to play sounds during sliding my finger on the buttons without taking my finger up?
(I read many questions but they aren’t useful)

my simple OnTouchListener for each button:

final ImageButton img_1 = (ImageButton) findViewById(R.id.img_1);
img_1.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
              if( event.getAction() ==  MotionEvent.ACTION_DOWN )   {
                snd.play_s_l_1(); 
              }
             return true;
        } 

 });
  • 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-17T23:24:22+00:00Added an answer on June 17, 2026 at 11:24 pm

    Check the MotionEvent.MOVE:

    private Rect rect;    // Variable rect to hold the bounds of the view
    
    public boolean onTouch(View v, MotionEvent event) 
    {
        if(event.getAction() == MotionEvent.ACTION_DOWN)
        {
            // Construct a rect of the view's bounds
            rect = new Rect(v.getLeft(), v.getTop(), v.getRight(), v.getBottom());
        }
        if(event.getAction() == MotionEvent.ACTION_MOVE)
        {
            if(!rect.contains((int)event.getX(), (int)event.getY()))
            {
                // User moved outside bounds
            }
        }
        return false;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to develop an android app that integrates social networking, and the first one
I'm trying to develop a simple android app. I want to know if an
I' trying to develop a screen on my android app like facebook login (App
I' trying to develop an Android app and I'm currently stuck with something. I
I am trying develop an Android app which uses Google maps. So for the
Im trying to develop my first ASP.NET MVC web app and have run into
im trying to develop an app for a win CE mobile device that downloads
Trying to develop a text editor, I've got two textboxes, and a button below
Iam trying to develop a web application, where when a button is clicked the
I am trying to develop a fb app. It shows me a error message

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.