码迷,mamicode.com
首页 >  
搜索关键字:getsystemservice    ( 396个结果
根据手机屏幕设置控件宽高
//获取手机宽度 WindowManager wm = (WindowManager) getActivity().getSystemService( Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); screenWidth = display.getWidth(); 给自己的控件设置...
分类:移动开发   时间:2015-08-27 13:31:33    阅读次数:136
输入法控制
切换输入法状态功能:切换输入法状态,即当输入法打开时,关闭它;当输入法关闭时,打开它。InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);//得到InputMethodManager的实例 if (imm.isActive()) { //如果输入法开启...
分类:其他好文   时间:2015-08-26 01:58:07    阅读次数:235
一次性关闭所有的Activity
原文:一次性关闭所有的Activity一次性关闭所有的Activity ActivityManager am = (ActivityManager)getSystemService (Context.ACTIVITY_SERVICE); am.restartPackage(getPackageNam...
分类:其他好文   时间:2015-08-21 10:47:08    阅读次数:117
Notification发送通知
今天学习并测试了Notification组件,这个组件在应用中也经常用到。在这里写了一个简单的Demo。 Notification是显示在状态栏的消息----位于手机屏幕的最上方。 程序一般通过NotificationManager服务来发送Notification。 Notification发送Notification的步骤 1、调用getSystemService(NOTIFICATI...
分类:其他好文   时间:2015-08-21 00:21:20    阅读次数:233
Android笔记:通知
可以在活动里创建,也可以在广播接收器里创建,还可以在服务里创建。NotificationManager manager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);创建一个Notification 对象就...
分类:移动开发   时间:2015-08-20 18:15:27    阅读次数:173
获取设备IMEI ,手机名称,系统SDK版本号,系统版本号
1、获取设备IMEI TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); String IMEIs = tm.getDeviceId() ;需要的权限 运行结果: 86746...
分类:移动开发   时间:2015-08-20 15:00:22    阅读次数:177
判断服务是否运行
public static boolean isServiceRun(Context context,String serviceName){ ActivityManager am = (ActivityManager) context.getSystemService(Con...
分类:其他好文   时间:2015-08-19 00:12:33    阅读次数:176
android获得屏幕高度和宽度
获取屏幕的宽度与高度有以下几种方法:1、WindowManager wm = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);intwidth = wm.getDefaultDisplay().getWidt...
分类:移动开发   时间:2015-08-13 17:13:42    阅读次数:150
android学习笔记---发送状态栏通知
发送消息的代码如下: //获取通知管理器 NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); int icon = andr....
分类:移动开发   时间:2015-08-13 01:08:46    阅读次数:148
android小技巧(二)
一、如何控制Android LED等?(设置NotificationManager的一些参数) 代码如下:final int ID_LED=19871103; NotificationManager nm=(NotificationManager)getSystemService(NOTIFIC.....
分类:移动开发   时间:2015-08-11 17:40:23    阅读次数:130
396条   上一页 1 ... 13 14 15 16 17 ... 40 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!