首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

android U盘检测及获取内存储器信息

2012-08-28 
android U盘检测及获取内存信息在网上查了一些资料。U盘检测的方法一般有两种方式,检测电池或者查看配置信

android U盘检测及获取内存信息

在网上查了一些资料。U盘检测的方法一般有两种方式,检测电池或者查看配置信息。

1.Batterymanager检测方法如下:

File Usbfile = new File("/proc/partitions");                if(Usbfile.exists()){                 try {                     FileReader  file= new FileReader("/proc/partitions");                         BufferedReader br=new BufferedReader(file);                         String strLine="";                         while((strLine=br.readLine())!=null)                        {                             if(strLine.indexOf("sd")>0)                            {                             searchFile("usb",Ufile);                                 System.out.println("Udisk insert---------------------------------->");                                 Log.d("Udisk","Udisk insert---------->");                                 break;                             }                         }                         br.close();                         file.close();                     } catch (Exception e) {                         // TODO Auto-generated catch block                         e.printStackTrace();                     }


热点排行