设置 USB tethering

                
  1.  public void setUSBTethering(boolean enabled){  
  2.          
  3.     ConnectivityManager cm =  
  4.             (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);  
  5.         if (cm.setUsbTethering(enabled) != ConnectivityManager.TETHER_ERROR_NO_ERROR ){  
  6.                 
  7.               System. out.println("usb tethering set failed !" );  
  8.         }  
  设置 USB debugging
                
  1. public void enableUSBDebugging()  
  2.  
  3.        int adbEnabled=0;  
  4.         
  5.        try {  
  6.              adbEnabled = Settings.Secure. getInt(getContentResolver(), Settings.Secure.ADB_ENABLED );  
  7.       } catch (SettingNotFoundException e) {  
  8.              e.printStackTrace();  
  9.       }  
  10.         
  11.        if(adbEnabled != 1){  
  12.              Settings.Secure. putInt(getContentResolver(),Settings.Secure. ADB_ENABLED, 1);  
  13.       }  
  14.         
  15.  

更多相关文章

  1. android Textview颜色渐变
  2. Android(安卓)中设置全屏的方法
  3. Android(安卓)设置View背景图网络url
  4. 第一章:初入Android大门(通过Button设置TextView颜色)
  5. Android使用继承View类来绘图
  6. android设置字符串到剪贴板
  7. Android(安卓)动态设置全屏,退出全屏
  8. android调用NotificationManager.notify无效,通知栏不显示
  9. android edittxet 设置可点击不可编辑状态

随机推荐

  1. android中 检查网络连接状态的变化,无网络
  2. uniapp制作Android纯净打包SDK项目
  3. 【Android】Android清除本地数据缓存代码
  4. Android安全论文汇集
  5. Android(安卓)Studio的.gitignore以及git
  6. [置顶] Android下实现自动关机的方法总结
  7. Android的MediaRecorder架构介绍
  8. android 的ListView中,判断其已滚动到最顶
  9. Android(安卓)动态添加View 并设置id
  10. Android(安卓)Studio安装Genymotion插件