I have a system overlay that sits above all Activities
and Windows
. The only problem is that it can only detect MotionEvents
when a user places his/her down on the screen (it can't track the finger's movements or detects when the finger is lifted). As a possible solution, I've implemented a second view (I'll call it the tracking view) that is able to handle all the touch events, but stays hidden until a touch in the desired location is detected by the system overlay; in that event, it will bring up the tracking view. Only problem is, that the tracking view doesn't start detecting touch events until the user places his/her finger back down on the screen. So to resolve this, I want to intercept the view that's getting the touch events (which is the view beneath the system overlay) and forward all its touch events to the tracking view to process.
Does anyone know how I can get the view that's receiving all the touch events and redirect all the touch events it's receiving?
This question refers to the examples used in this question.
You can't do exactly what you are asking. The input system is very careful to restrict what windows can receive what events; it is deliberately not like other systems such as Microsoft Windows where you can get involved in the low-level event dispatching and see everything going on. The only things allowed are:
A further core rule of event dispatching to windows is that once a window is selected as the target of the touch event, it will continue to receive the event stream until the final up. Traditionally in Android this would apply to all further fingers of the touch gesture (it receives all fingers, no matter where they appear, until the last finger goes up). More recent versions of the platform allow you to modify this behavior to be multi-touch aware: http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_SPLIT_TOUCH
So those are the tools you have in your tool box. You can build the things that are possible with them, but this is not intended to allow you to do any possible kind of interaction with the event system, so there are going to be limits.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With