外部项目引入如果没找到工程文件要先创建一个android项目在引入。
根据要查看的项目名在项目中搜索逐步查看
====================
内存详情获取:
1 public class MainActivity extends Activity { 2 3 @Override 4 protected void onCreate(Bundle savedInstanceState) { 5 super.onCreate(savedInstanceState); 6 setContentView(R.layout.activity_main); 7 TextView tvmemory=(TextView)findViewById(R.id.tv_memory_info); 8 //获得SD卡的路径 9 File sdCart= Environment.getExternalStorageDirectory(); 10 //容量 11 String sdCartMemory= getMemoryByInfo(sdCart); 12 //获得手机路径 13 File dataFileDir=Environment.getDataDirectory(); 14 //容量 15 String dataMemory=getMemoryByInfo(dataFileDir); 16 tvmemory.setText("SD卡空间:"+sdCartMemory+"手机内存空间:"+dataMemory); 17 } 18 19 /* 20 * 根据路径获取空间容量 21 * @param path 路径 22 * */ 23 private String getMemoryByInfo(File path){ 24 //获得一个磁盘对象 25 StatFs stat=new StatFs(path.getPath()); 26 27 long blockSize=stat.getBlockSize();//获得扇区的大小(硬盘) 28 long totalBlocks=stat.getBlockCount();////获得扇区的总数 29 long availableBlocks=stat.getAvailableBlocks();//获得可用扇区数量 30 //获得总扇区大小 31 String totalMemory = Formatter.formatFileSize(this, totalBlocks*blockSize); 32 String availableMemory = Formatter.formatFileSize(this, availableBlocks*blockSize); 33 return "总空间:"+totalMemory+" 剩余空间:"+availableMemory; 34 } 35 }
PULL解析请看:http://www.cnblogs.com/cuijl/p/4530044.html