码迷,mamicode.com
首页 >  
搜索关键字:getsystemservice    ( 396个结果
布局填充器的三种写法
布局填充器的三种写法: 1.layoutInflater=layoutInflater.from(this); 2.layoutInflater=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); 3.layoutIn...
分类:其他好文   时间:2014-12-05 10:27:56    阅读次数:146
Android 手动显示和隐藏软键盘
1、方法一(如果输入法在窗口上已经显示,则隐藏,反之则显示)InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);imm.toggleSoftInput(0, Inpu...
分类:移动开发   时间:2014-12-03 13:51:01    阅读次数:156
android to hide the keybord
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0)...
分类:移动开发   时间:2014-12-03 12:13:39    阅读次数:164
android手机获取手机号
最近做到一个项目,需要获取手机号。项目中使用的手机卡为电信卡,那么就以此为例吧。网上不符合需求的方法Google了一下,网上的做法如下://获取手机号码TelephonyManagertm=(TelephonyManager)this.getSystemService(Context.TELEPHO...
分类:移动开发   时间:2014-12-03 11:46:26    阅读次数:219
android 中的Context(一)
context的功能如此强大,它是activity的父类。public abstract class Context { ... public abstract Object getSystemService(String name); //获得系统级服务 public abstract ...
分类:移动开发   时间:2014-12-02 20:29:43    阅读次数:214
Android开发之来电电话挂断实现
在Android1.5版本之前,实现挂断电话是非常容易的事,只需要调用TelephonyManager的endCall()方法就可以了,但在1.5版本之后,Google工程师为了手机的安全期间,把endCall的方法隐藏掉了。所以实现挂断电话可以通过反射的方法,执行endCall方法。具体实现如下: TelephonyManager在源码里是这样描述的:Context.getSystemService(Context.TELEPHONY_SERVICE)},我们通过TELEPHONY_SERVICE系统服...
分类:移动开发   时间:2014-11-30 20:10:13    阅读次数:277
Android Notification使用及取消
//发送通知NotificationManager manger = (NotificationManager) this.getSystemService(NOTIFICATION_SERVICE);Notification noti = new Notification(R.drawable.i...
分类:移动开发   时间:2014-11-27 12:41:30    阅读次数:158
android获取屏幕宽度和高度
1.WindowManager wm = (WindowManager) getContext() .getSystemService(Context.WINDOW_SERVICE); int width = wm.getDefaultDisplay(...
分类:移动开发   时间:2014-11-26 16:11:45    阅读次数:152
android获取USB设备的名称
1.注释内 。是三星设备可能不支持,需要更换的代码。2.mUsbManager。是getSystemService(Context.USB_SERVICE)获的。3. 从stackoverflow摘过来的。源地址找不到咧。 protected static final int STD_USB_REQ...
分类:移动开发   时间:2014-11-26 13:53:52    阅读次数:257
android退出应用时候清除数据
退出应用的时候调用下面方法,就可以清楚数据了。 +        ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE); +        boolean res = am.clearApplicationUserData(); +        if (!res) { +     ...
分类:移动开发   时间:2014-11-22 12:07:44    阅读次数:176
396条   上一页 1 ... 26 27 28 29 30 ... 40 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!