There are two types of mobile phone storage, one is the storage of the handset, called internal storage, another kind of user's extra storage, called Removable Storage (that is, the part of the external sdcard).
The path of Removable Storage is generally storage/emulated/0/android/data/com.example.storagetest/files/alarm
Internal storage also has a part called external (that is, the part of the built-in sdcard), and this part of the path is/storage/emulated/0
Get the built-in SDcard path method
by Context.get....dir or Environment.get...dir to get
Get the external SDcard path method
1.String Extsdcardpath = system.getenv ("Secondary_storage");
2. Get through StorageManager.
StorageManagerMstoragemanager=(StorageManager)Mcontext.Getsystemservice(Context.Storage_service);Class<?>Storagevolumeclazz=Null;Try{Storagevolumeclazz=Class.Forname("Android.os.storage.StorageVolume");MethodGetvolumelist=Mstoragemanager.GetClass().GetMethod("Getvolumelist");MethodGetPath=Storagevolumeclazz.GetMethod("GetPath");MethodIsRemovable=Storagevolumeclazz.GetMethod("IsRemovable");ObjectResult=Getvolumelist.Invoke(Mstoragemanager);FinalIntLength=Array.GetLength(Result);For(IntI=0;I<Length;I++){ObjectStoragevolumeelement=Array.Get(Result,I);StringPath=(String)GetPath.Invoke(Storagevolumeelement)//If there is an external sdcard, then the Sdcard1 is external.BooleanRemovable=(Boolean)IsRemovable.Invoke(Storagevolumeelement);If(Is_removale==Removable){ReturnPath;}}}Catch(ClassNotFoundExceptionE){E.Printstacktrace();}Catch (invocationtargetexception e{ span class= "n" >e. (); } catch (nosuchmethodexception e< Span class= "O" >) {e. Printstacktrace (); } catch (illegalaccessexception e ) {e. Printstacktrace (); return null
Android SDcard Information acquisition