Android obtains the total capacity of the SD card, available size, total body memory capacity and available size, and androidsd
Public long getSDTotalSize () {/* get the memory card path */File sdcardDir = Environment. getExternalStorageDirectory ();/* StatFs View File Syste
This article describes the Android implementation to obtain the total capacity of SD card, available size, total memory capacity of the fuselage and the available size of the method. Share to everyone for your reference, specific as follows:
Maybe some students do not know that the system has been provided to obtain t
Public long getsdtotalsize () {/* Gets the memory card path */File sdcarddir= environment.getexternalstoragedirectory (); /*statfs See File system space Usage */StatFs statfs=new StatFs (Sdcarddir.getpath ()); Long blocksize= Statfs.getblocksizelong (); Long Totalsize=statfs.getblockcountlong (); return blocksize*totalsize;} /** * Get the remaining capacity of
Public Longgetsdallsize () {3 //get SD card file path4File Path =environment.getexternalstoragedirectory ();5StatFs SF =NewStatFs (Path.getpath ());6 //gets the size of a single data block (Byte)7 LongBlockSize =Sf.getblocksizelong ();8 //get the number of all data blocks9 LongAllblocks =Sf.getblockcountlong ();Ten //return
Continue the android learning journey. Today, we use a small example to get the SD card capacity and the phone ROM capacity. The Code is as follows:
Package com. urovo. sdcardspace; import java. io. file; import android. OS. bundle; import android. OS. environment; import android. OS. statFs; import android. app. acti
This article is an example of how Android obtains SD card and cell phone ROM capacity. Share to everyone for your reference, specific as follows:
Here is a simple example to get the capacity of the SD card and the
This paper illustrates the existence of the SD card and the implementation of capacity query using the Android programming method. Share to everyone for your reference, specific as follows:
1. To determine whether the existence of SD card returns TRUE indicates existence
An easy way for Android to determine the presence and capacity of an SD card is as follows:The first step is to increase the access rights of the SD card in Androidmanifest.xml[HTML]View Plaincopy
uses-permission android:name="Android.permission.MOUNT_UNMOUNT_F
Hippocampus simulator is an Android simulator, we can simulate the setup of the phone's SD card, then if the SD card mirrored file capacity directly to expand, you need to find a way, SD card
The first step is to increase the access rights of the SD card in Androidmanifest.xmldoes the SD card existPrivate Boolean Existsdcard () { if (android.os.Environment.getExternalStorageState (). Equals ( Android.os.Environment.MEDIA_MOUNTED) { return true; } else return false; }
Solution:1. Supports Micro SD memory cards, but does not support standard SD cards2. The MIIX700-12isk supports a maximum of GB Micro SD memory card. Because the Micro SD memory card involves multiple brands, we recommend that you
This article illustrates the method of acquiring SD card path and remaining capacity by Android programming. Share to everyone for your reference, specific as follows:
public static string Getexternalstoragepath () {
//Get SDcard status
string state = Android.os.Environment.getExternalStorageState ();
To determine if sdcard exists and is available
if
When you use MediaPlayer to play a local Mp3 file , you need to be aware of the problem with access paths and access permissions .1. Access path:/storage/emulated/0 This path is the root path of the phone, you can download the es file browser software to view the current playing MP3 specific path, through Environment.getexternalstoragedirectory (). GetPath () gets /storage/emulated/0 This sdcard path This in the organization void Android.media.M
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.