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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:26:01+00:00 2026-06-14T14:26:01+00:00

I got a problem with my touchlistener and actually dont get it work correctly.

  • 0

I got a problem with my touchlistener and actually dont get it work correctly.

    @Override
public boolean onTouchEvent(MotionEvent event) {

    touchControll.processTouchEvent(event); //should do everything!
    invalidate();
    return true; 
}

The Methode processTouchevent simply take the event watch where it was and handles it.
So if the touch was inside of the Joypad it handles the joypad “actions”. But if i want to handle a hitButton event now it dont react.

Example

    public void processHitButtonTouch(MotionEvent event){
    int touchPosX = (int) event.getX();
    int touchPosY = (int) event.getY();
    if(event.getAction() == MotionEvent.ACTION_DOWN)
        if(touchPosX > Config.BLOCKSIZE*37 && touchPosY > Config.BLOCKSIZE*3 && touchPosY < Config.BLOCKSIZE*7){
            this.hitButton.buttonStatus = Pressed.PRESSED;
        }
    }

on every MotionEvent.ACTION_UP i resett the whole stuff like this:

    if(event.getAction() == MotionEvent.ACTION_UP){
        joyPad.status = Status.IDLE;
        charac.setStatus(Status.IDLE);
        this.hitButton.buttonStatus = Pressed.UNPRESSED;
    }

I tied if it actually handles more than 1 event with the Loggincat and it does (2 touch 2 times downevent logged!). But it simply dont work like i did it here.
What have i done wrong?!

Thanks alot for the help!

  • 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-14T14:26:02+00:00Added an answer on June 14, 2026 at 2:26 pm

    The touch events are caught by only one view in Android, so it’s normal if your hitButton doesn’t react while you keep your finger on the Joypad.

    To use multitouch, you have to implement a global view with all your buttons inside (joypad, hitbutton …). So this view catch the event and pass it on the joypad’s touchEventListener or the hitButton’s listener.

    Edit : Here an exemple with 2 joysticks

    http://code.google.com/p/mobile-anarchy-widgets/source/browse/trunk/Widgets/src/com/MobileAnarchy/Android/Widgets/Joystick/DualJoystickView.java?r=30

    Edit2 : a good tutorial

    http://android-developers.blogspot.fr/2010/06/making-sense-of-multitouch.html

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

Sidebar

Related Questions

got a problem, can't get my head around this jquery and would appreciate your
I have got problem with this method: public List<int> menu_wid_w_kat() { DataSet1TableAdapters.menu_widac_wszystkoTableAdapter pk =
I've got problem with Activity Feed and event in JavaScript-SDK. When user log in
I think my apache webserver has got problem. I can't reference jquery.js I get
i got problem with my code , i am trying to get image from
I've got problem with dropping foreign key index, I always get the same error
I got problem with line breaks in a textarea. I get the text with
Hi I've got problem with foreach statement. I have my controller method: public ActionResult
I've got problem with sorting entries in JqGrid. Orderby seem to not work. I
i got problem that when i submit form in jquery/ajax i get the data

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.