有时候退出Activity时,因为前面使用了输入法,退出时候输入法键盘还没有关闭,这种效果不友好,
下面是在按后退键时候加入以下代码
if (view!= null) {
InputMethodManager inputmanger = (InputMethodManager) getSystemService(Context.INPUT_METH...
分类:
移动开发 时间:
2014-08-29 14:44:08
阅读次数:
238
一、打开输入法窗口:InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); // 接受软键盘输入的编辑文本或其它...
分类:
其他好文 时间:
2014-08-29 14:38:47
阅读次数:
215
在个别时候,需要强制隐藏Android输入法键盘,如当前键盘正在显示,这个时候点击了侧滑面板,就要强制隐藏输入法键盘。网上常见的方法有:1、 InputMethodManager imm = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftI...
分类:
移动开发 时间:
2014-08-28 00:56:48
阅读次数:
314
//?隐藏输入法
InputMethodManager?imm?=?(InputMethodManager)?getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
//?显示或者隐藏输入法
imm.toggleSoftInput(0,?InputMethod...
分类:
移动开发 时间:
2014-08-27 23:37:08
阅读次数:
397
直接上代码:
/**
* 获取SIM卡运营商
*
* @param context
* @return
*/
public static String getOperators(Context context) {
TelephonyManager tm = (TelephonyManager) context
.getSystemService(Conte...
分类:
移动开发 时间:
2014-08-27 23:31:18
阅读次数:
355
获取正在运行的程序并把它加入到一个listview的adapter类面,方法如下:
// 正在运行的
public List getRunningProcess() {
pi = new PackagesInfo(this);
am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
// 获取正在运行的应用
ru...
分类:
移动开发 时间:
2014-08-27 22:06:52
阅读次数:
375
TextView tv=(TextView)findViewById(R.id.tv);
TelephonyManager telManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
// 获取SIM卡的IMSI码
String imsi = telManag...
分类:
移动开发 时间:
2014-08-21 11:32:02
阅读次数:
237
WindowManager mgr = ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE));int lastOrientation= mgr.getDefaultDisplay().getRotation()...
分类:
其他好文 时间:
2014-08-20 15:58:22
阅读次数:
241
TelephonyManager telManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); /** 获取SIM卡的IMSI码 * SIM卡唯一标识:IMSI 国际移动用户识别码...
分类:
其他好文 时间:
2014-08-18 18:24:32
阅读次数:
294
最近太忙了。好长时间没动博客,把原来的东西拿出来都重新温习下。
private void collapseStatusBar() {
int currentApiVersion = android.os.Build.VERSION.SDK_INT;
try {
Object service = getSystemService("s...
分类:
移动开发 时间:
2014-08-14 14:14:48
阅读次数:
192