java - Can new File() constructor return null on Android? -


i saw code in android training center website:

boolean hasexternalstorageprivatefile() {     // path file on external storage.  if external     // storage not mounted fail.     file file = new file(getexternalfilesdir(null), "demofile.jpg");     if (file != null) {         return file.exists();     }     return false; } 

does mean on android new file() can return null?

http://developer.android.com/reference/android/content/context.html#getexternalfilesdir(java.lang.string)

no, constructor may never return null. constructor either returns initialised object or throws exception or error.


Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -