//获取手机宽度
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 ActivityManager am = (ActivityManager)getSystemService (Context.ACTIVITY_SERVICE); am.restartPackage(getPackageNam...
分类:
其他好文 时间:
2015-08-21 10:47:08
阅读次数:
117
今天学习并测试了Notification组件,这个组件在应用中也经常用到。在这里写了一个简单的Demo。
Notification是显示在状态栏的消息----位于手机屏幕的最上方。
程序一般通过NotificationManager服务来发送Notification。
Notification发送Notification的步骤
1、调用getSystemService(NOTIFICATI...
分类:
其他好文 时间:
2015-08-21 00:21:20
阅读次数:
233
可以在活动里创建,也可以在广播接收器里创建,还可以在服务里创建。NotificationManager manager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);创建一个Notification 对象就...
分类:
移动开发 时间:
2015-08-20 18:15:27
阅读次数:
173
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
获取屏幕的宽度与高度有以下几种方法:1、WindowManager wm = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);intwidth = wm.getDefaultDisplay().getWidt...
分类:
移动开发 时间:
2015-08-13 17:13:42
阅读次数:
150
发送消息的代码如下: //获取通知管理器 NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); int icon = andr....
分类:
移动开发 时间:
2015-08-13 01:08:46
阅读次数:
148
一、如何控制Android LED等?(设置NotificationManager的一些参数) 代码如下:final int ID_LED=19871103; NotificationManager nm=(NotificationManager)getSystemService(NOTIFIC.....
分类:
移动开发 时间:
2015-08-11 17:40:23
阅读次数:
130