android 判断是否有触摸屏
3个回答
推荐于2016-06-29
展开全部
public void onCreate(Bundle savedInstanceState) {
final IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_SCREEN_OFF);
filter.addAction(Intent.ACTION_SCREEN_ON);
registerReceiver(mBatInfoReceiver, filter);
}
private final BroadcastReceiver mBatInfoReceiver = new BroadcastReceiver() {
@Override
public void onReceive(final Context context, final Intent intent) {
final String action = intent.getAction();
if(Intent.ACTION_SCREEN_ON.equals(action)){
Log.d(TAG, "-----------------screen is on...");
}else if(Intent.ACTION_SCREEN_OFF.equals(action)){
Log.d(TAG, "----------------- screen is off...");
}
}
};
final IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_SCREEN_OFF);
filter.addAction(Intent.ACTION_SCREEN_ON);
registerReceiver(mBatInfoReceiver, filter);
}
private final BroadcastReceiver mBatInfoReceiver = new BroadcastReceiver() {
@Override
public void onReceive(final Context context, final Intent intent) {
final String action = intent.getAction();
if(Intent.ACTION_SCREEN_ON.equals(action)){
Log.d(TAG, "-----------------screen is on...");
}else if(Intent.ACTION_SCREEN_OFF.equals(action)){
Log.d(TAG, "----------------- screen is off...");
}
}
};
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
安兔兔硬件软件,里面有屏幕点检测
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你不是用手点的吗 这就是有吗
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询