Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm writing a game for OUYA and Android and I'm using the trackpad on the OUYA controller. When ever you touch it a mouse pointer comes up and I can't find a way to hide it. I image this would be a problem for games on an Android netbook as well. Has anyone found a way to interact with the cursor instead of just listening for events?

share|improve this question
    
Seems to be an issue on both the Java and Unity sides: forums.ouya.tv/discussion/comment/2968 You may want to chime in on that discussion, or start a new one, as I think those forums get a bit more official love than does SO. –  CommonsWare Jan 13 '13 at 23:42
    
Yeah, I read that thread and from what I gather there is no JNI connection to allow that from Unity. I'm just using Java so I thought I'd post here and see if there was a general Android solution. –  CaseyB Jan 14 '13 at 16:15

2 Answers 2

This won't hide the mouse, but it will at least help prevent touch events from interfering with your joystick processing code -- not a proper solution I know, but still might help people who land on this page:

public boolean onGenericMotionEvent(MotionEvent event) {
    if ( (event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
        //handle the event
        return true;
    }
    else {
        return false;
    }
}
share|improve this answer
1  
I tried to override this for my NativeActivity. I can override for onKeyDown() and onKeyUp() but when trying to override the motion func, I get: "method does not override or implement a method from a supertype" –  Bram Feb 11 '13 at 2:42

Android currently does not expose any functionality to hide the mouse cursor. Whenever you have an external pointing device (ie. usb/bluetooth mouse, trackpad, etc) a mouse pointer will appear on the screen whenever you interact with the device.

Unfortunately (as of JB 4.2.2) this means it is impossible without a modified ROM.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.