简体   繁体   中英

How to find Path of Internal Phone Storage, Personal Data, Internal SD Card, External SD Card and Memory Size?

I am a beginner in android. I want to know how to programmatically find the path to Internal SD card, External SD card, Internal Phone Storage and Personal Data in android. I also want to know how to find their memory size (Used and Free Space).
If it is possible please send information. Otherwise send Reason. Please reply your answers and comments are valuable me. Thanks.

 File sdCardDirectory = Environment.getExternalStorageDirectory(); 

 This is to find sdcard path

 File path = Environment.getDataDirectory();
 StatFs stat = new StatFs(path.getPath()); 
 long blockSize = stat.getBlockSize(); 
 long availableBlocks = stat.getAvailableBlocks(); 
 return Formatter.formatFileSize(this, availableBlocks * blockSize); 

 This is to find Internal Phone Storage

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM