获取坐标触摸屏的后台服务 [英] Get co-ordinates touch screen in a background service
本文介绍了获取坐标触摸屏的后台服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只是想知道知道,如果有一个后台服务一个可以负责协调所有活动触摸屏事件。
这样那样的
*最后的TextView TextView的=(的TextView)findViewById(R.id.textView);
最后查看的TouchView = findViewById(R.id.touchView);
touchView.setOnTouchListener(新View.OnTouchListener(){
@覆盖
公共布尔onTouch(视图V,MotionEvent事件){
textView.setText(触摸坐标:+将String.valueOf(event.getX())+×+将String.valueOf(event.getY()));
返回true;}
但没有任何默认视图。
谢谢
解决方案
我只是想知道知道是否能 与后台服务有 坐标触摸屏事件 在所有的活动。
没有,对不起。你的活动,可以通过有关触摸事件的服务的信息,而是一种服务不能直接接收触摸事件。
I'm just wondering to know if a can with a background service have co-ordinates of a touch screen event in all activities.
Such like that
*final TextView textView = (TextView)findViewById(R.id.textView);
final View touchView = findViewById(R.id.touchView);
touchView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
textView.setText("Touch coordinates : " +String.valueOf(event.getX()) + "x" + String.valueOf(event.getY()));
return true;}
but without any view by default.
Thanks
解决方案
I'm just wondering to know if a can with a background service have co-ordinates of a touch screen event in all activities.
No, sorry. Your activities can pass information about touch events to a service, but a service cannot directly receive touch events.
这篇关于获取坐标触摸屏的后台服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文