Skip to content Skip to sidebar Skip to footer

Receiving Touch Events From A Service (solution?)

So, earlier I posted a question about receiving touch events from a service (apparently no one knows the answer). After trying to figure it out myself for hours, I gave up and dec

Solution 1:

I use code like this.

int nFlags=WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL|WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;       
             m_cWM=(WindowManager)getSystemService(Context.WINDOW_SERVICE);
             WindowManager.LayoutParamslp=newWindowManager.LayoutParams(
                WindowManager.LayoutParams.WRAP_CONTENT,WindowManager.LayoutParams.WRAP_CONTENT,
                WindowManager.LayoutParams.TYPE_SYSTEM_ERROR,
                nFlags,
                PixelFormat.TRANSLUCENT);
m_cWM.addView(YourViewClass, lp);

And don't forget about uses-permissions

Post a Comment for "Receiving Touch Events From A Service (solution?)"