touch - ANDROID: How to create an virtual area on screen on top of everything which user can press to perform actions? -
I'm trying to do something like sleeppad, taskask, and tasky where the user swipes / touches Area of the phone screen just like the edges and program work, even if its activity is not visible.
I do not know where it starts, because I do not even know about it
Any help would be greatly appreciated!
A similar question has been answered here:
No , sorry. Your activities can give information about a service to a touch event, but a service can not directly receive touch events
, but you get touch events only with running activity can do.
Here's how you will get a touch listener in the activity:
ImageView playLayout = (ImageView) findViewById (R.id.playLayout); PlayLayout.setKeepScreenOn (right); PlayLayout.setOnTouchListener (see new OnTouchListener) {@ Override Public Boolean On Touch (View View, Motion Event Me) {Float New Y = Me.Gateway (); Float NewX = I.T.T.X (Int.) Action = Me. Gate Action (if;); (Action == 0) {Log V (Tag, "New Touch"); Log I (Tag, string.valouf ("Action" + Action + "happened in X, Y: "+" ("+ + NewX +", "+ newY +")));} True Truth;}});
Of course you can add more for this There, I just logged the X and Y coordinates I where touch.
Comments
Post a Comment