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' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -