android 获取SD卡相关信息
Object localOb;
String str1 = null; try {
localOb = new FileReader("/sys/block/mmcblk0/device/type");
localOb = new BufferedReader((Reader) localOb).readLine()
.toLowerCase().contentEquals("sd");
if (localOb != null) {
str1 = "/sys/block/mmcblk0/device/";
}
} catch (Exception e1) {
System.out.println(e1.getMessage());
}
try {
localOb = new FileReader("/sys/block/mmcblk1/device/type");
localOb = new BufferedReader((Reader) localOb).readLine()
.toLowerCase().contentEquals("sd");
if (localOb != null) {
str1 = "/sys/block/mmcblk1/device/";
}
} catch (Exception e1) {
System.out.println(e1.getMessage());
}
try { localOb = new FileReader("/sys/block/mmcblk2/device/type");
localOb = new BufferedReader((Reader) localOb).readLine()
.toLowerCase().contentEquals("sd");
if (localOb != null) {
str1 = "/sys/block/mmcblk2/device/";
}
} catch (Exception e1) {
System.out.println(e1.getMessage());
}
localOb = "";
try {
localOb = new FileReader(str1 + "name"); // 厂商
String sd_name = new BufferedReader((Reader) localOb).readLine();
System.out.println("name: " + sd_name);
} catch (Exception e1) {
System.out.println(e1.getMessage());
} try {
localOb = new FileReader(str1 + "cid"); // SD Card ID
String sd_cid = new BufferedReader((Reader) localOb).readLine();
System.out.println("cid: " + sd_cid);
} catch (Exception e1) {
System.out.println(e1.getMessage());
} try {
localOb = new FileReader(str1 + "csd");
String sd_csd = new BufferedReader((Reader) localOb).readLine();
System.out.println("csd: " + sd_csd);
} catch (Exception e1) {
System.out.println(e1.getMessage());
} try {
localOb = new FileReader(str1 + "fwrev"); // 固件编号
String sd_fwrev = new BufferedReader((Reader) localOb).readLine();
System.out.println("fwrev: " + sd_fwrev);
} catch (Exception e1) {
System.out.println(e1.getMessage());
} try {
localOb = new FileReader(str1 + "hwrev"); // 硬件版本
String sd_hwrev = new BufferedReader((Reader) localOb).readLine();
System.out.println("hwrev: " + sd_hwrev);
} catch (Exception e1) {
System.out.println(e1.getMessage());
} try {
localOb = new FileReader(str1 + "manfid"); // manufacture 制造
String sd_manfid = new BufferedReader((Reader) localOb).readLine();
System.out.println("manfid: " + sd_manfid);
} catch (Exception e1) {
System.out.println(e1.getMessage());
} try {
localOb = new FileReader(str1 + "oemid"); // 原始设备制造商
String sd_oemid = new BufferedReader((Reader) localOb).readLine();
System.out.println("oemid: " + sd_oemid);
} catch (Exception e1) {
System.out.println(e1.getMessage());
} try {
localOb = new FileReader(str1 + "scr");
String sd_scr = new BufferedReader((Reader) localOb).readLine();
System.out.println("scr: " + sd_scr);
} catch (Exception e1) {
System.out.println(e1.getMessage());
} try {
localOb = new FileReader(str1 + "serial"); // 串号/序列号
String sd_serial = new BufferedReader((Reader) localOb).readLine();
System.out.println("serial: " + sd_serial);
} catch (Exception e1) {
System.out.println(e1.getMessage());
} try {
localOb = new FileReader(str1 + "date"); // 生产日期
String sd_date = new BufferedReader((Reader) localOb).readLine();
System.out.println("date: " + sd_date);
} catch (Exception e1) {
System.out.println(e1.getMessage());
}
android 获取SD卡相关信息的更多相关文章
- Android 获取SD卡路径和推断SD卡是否存在
android获取sd卡路径方法: 不建议直接写死android sd卡的路径. public String getSDPath(){ File sdDir = null; boolean sdCar ...
- android 获取sd卡根目录
dir:/storage/emulated/0 也就是 sdcard目录 ====== android 获取sd卡根目录 public String getSDPath(){ File ...
- Android获取SD卡路径及SDCard内存的方法
这篇文章主要介绍了Android获取SD卡路径及SDCard内存的方法,较为详细的分析了Android针对SD卡操作所涉及的类及其具体函数功能,非常具有实用价值,需要的朋友可以参考下 本文实例讲述了A ...
- Android获取SD卡路径/内存的几种方法
Android获取SD卡路径 本篇将会带领大家学习如何获取android路径的几种常见用法,但在我开始bb之前需要大家清楚android中内存和外存之间的区别,下面进行简短介绍:android中的内存 ...
- Android - 获取SD卡的内存空间大小
获取SD卡的内存空间大小 //获得SD卡空间的信息 File path=Environment.getExternalStorageDirectory(); StatFs statFs=new Sta ...
- Android 获取SD卡的图片资源
首先我先获得SD卡下的根目录路径: privateString isSdcard(){ File sdcardDir=null; boolean isSDExist=Environment.getEx ...
- Android获取SD卡中选中图片的路径(URL)
最近在做一个图片上传的功能,需要提供上传图片在SD卡中的路径,在网上看了些例子,改改调试成功,代码很简单.其布局文件如下: [html] view plain copy <?xml ver ...
- android获取sd卡路径方法
public String getSDPath(){ File sdDir = null; boolean sdCardExist = Environment.getExternalStorage ...
- Android获取SD卡总容量,可用大小,机身内存总容量及可用大小
public long getSDTotalSize() { /*获取存储卡路径*/ File sdcardDir= Environment.getExternalStorageDirectory() ...
随机推荐
- rem ,em ,px的区别
参考网址:http://www.cnblogs.com/leejersey/p/3662612.html
- Android数据库 — — —查询数据
package com.example.datebasetest; import android.content.ContentValues;import android.database.Curso ...
- a primary example for Functional programming in javascript
background In pursuit of a real-world application, let’s say we need an e-commerce web applicationfo ...
- css z-index
使用z-index的position必须是relative或者是absolute
- 向通知栏发送通知点击跳转并传递数据(PendingIntent)传递数据
// 为发送通知的按钮的点击事件定义事件处理方法 public void send() {///// 第一步:获取NotificationManager NotificationManager nm ...
- 【Learning Python】【第二章】Python基础类型和基础操作
基础类型: 整型: py 3.0解决了整数溢出的问题,意味着整型不必考虑32位,64位,有无符号等问题,你写一个1亿亿亿,就是1亿亿亿,不会溢出 a = 10 ** 240 print(a) 执行以上 ...
- BackTrack5-r3 w3af无法更新问题解决
wget http://pypi.python.org/packages/source/p/pybloomfiltermmap/pybloomfiltermmap-0.2.0.tar.gz --no- ...
- vimperator setting records
vimperator confugration files :highlight Hint color:#000;background:rgb(250,230,150);border-radius:4 ...
- magento的url中 去掉多余的目录层级
有时我们需要仅仅显示一层目录的URL路径.而不要出现多个路径的现实,我们可以用以下方法修改: Edit /app/code/core/Mage/Catalog/Model/Url.php 找到632 ...
- IOS7.0 UILabel实现自适应高度的新方法
//IOS7.0中利用- (CGRect)boundingRectWithSize:(CGSize)size options:(NSStringDrawingOptions)options attri ...