protected static InputStream getConfigurationFileFromSDCard ( String fileName ) { File sdcard = Environment . getExternalStorageDirectory ( ) ; if ( sdcard == null || ! sdcard . exists ( ) || ! sdcard . canRead ( ) ) { return null ; } String sdCardPath = sdcard . getAbsolutePath ( ) ; File propFile = new File ( sdCardPath + "/" + fileName ) ; if ( ! propFile . exists ( ) ) { return null ; } FileInputStream fileIs = null ; try { fileIs = new FileInputStream ( propFile ) ; } catch ( FileNotFoundException e ) { // should not happen, we check that above return null ; } return fileIs ; }
Gets an input on a configuration file placed on the the SDCard .