获取sd卡空间大小
TextView tv_total_size = (TextView)findViewById(R.id.textView1);
TextView tv_useable_size = (TextView)findViewById(R.id.textView2); File file =Environment.getExternalStorageDirectory();
long totalSpace = file.getTotalSpace();
long usableSpace = file.getUsableSpace(); String formatToatalSpace = Formatter.formatFileSize(this, totalSpace);
String formatUsableSpace =Formatter.formatFileSize(this, usableSpace); tv_total_size.setText("总大小:"+formatToatalSpace);
tv_useable_size.setText("可用空间:"+formatUsableSpace);
获取sd 卡目录
String sdPath =Environment.getExternalStorageDirectory().getPath();