android - Difference between Environment.getExternalStorageDirectory() and Environment.getExternalStorageDirectory().getAbsolutePath() -
what's difference between
environment.getexternalstoragedirectory()
and
environment.getexternalstoragedirectory().getabsolutepath()
or
environment.getexternalstoragedirectory().getcanonicalpath()
or
environment.getexternalstoragedirectory().getpath()
i know getabsolutepath(), getcanonicalpath() , getpath() are.
i see in examples environment.getexternalstoragedirectory() used this:
getexternalstoragedirectory() + "/somefolder/anotherfolder/"
what confuses me getexternalstoragedirectory() default refers , why in cases people use methods , when alright use getexternalstoragedirectory() without it?
i know getabsolutepath(), getcanonicalpath() , getpath() are.
then know answer original question ("what's difference between..."), since thing different calls.
what getexternalstoragedirectory() default refers to
it refers root of external storage. when user mounts android device via usb cable , gets drive letter or volume or something, drive points directory getexternalstoragedirectory()
points to.
generally speaking, developers should not using getexternalstoragedirectory()
, instead getexternalfilesdir()
, kin on context
, or getexternalstoragepublicdirectory()
on environment
.
why in cases people use methods
well, have create file
objects pointing @ location on external storage somehow. while better use proper file
constructor that, lazy programmers use string concatenation. , that, need string.
when alright use getexternalstoragedirectory() without it?
never, or close it, because not useful value on own. that's akin asking when use c:
in windows programming. that's drive letter, , simple drive letter on own sufficient. need path directory or file, , that, need add stuff c:
(at minimum, backslash).
Comments
Post a Comment