收集android的三个小tip

1)Android 开发中 HttpClient 超时设置
httpclient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 3000);
//连接超时

httpclient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, 5000);
//读取超时


2) 调用指定的程序打开指定文件,比如:
Intent i = new Intent();i.setComponent(new ComponentName("com.redirectin.rockplayer.android.unified", "com.redirectin.rockplayer.android.OpenRockPlayerActivity"));//包名 类名,可以用APKTool反编译apk包,查AndroidManifest.xmlUri name = Uri.parse("http://192.168.1.129/1.f4v");i.setData(name);startActivity(i);



3)开启与关闭软键盘
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);  //得到InputMethodManager的实例if (imm.isActive()) {//如果开启imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_NOT_ALWAYS); //关闭软键盘,开启方法相同,这个方法是切换开启与关闭状态的}

更多相关文章

  1. 收集android的三个小tip
  2. (mac)Android(安卓)Studio安装以及Fetching android sdk compone
  3. android开关控件使用(一)
  4. 【Android】如何调节屏幕亮度,关闭屏幕
  5. 关于Android锁屏的问题
  6. 关于Android锁屏的问题
  7. Android(安卓)开启闪光灯做手电筒 源码
  8. (window)Android(安卓)Studio安装以及Fetching android sdk comp
  9. ANR android

随机推荐

  1. android俄罗斯方块完整代码
  2. Android(安卓)Studio 编译缓存(Build Cac
  3. 技能积累
  4. 安装android开发环境原始版(windows版)
  5. ViewModels 和 LiveData:模式 +反模式
  6. Mac编译FFmpeg Android动态so库实践
  7. Android之Banner的滚动轮播实现
  8. android 数据存储——SharedPreferences,
  9. Android(安卓)Design Support Library 控
  10. Android(安卓)Matrix进阶方法详解