This seems to happen in some cases when there is no
SD card.
if (dictDir.isDirectory() && dictDir.list().length > 0) {
return dir;
}
- File efd = getApplicationContext().getExternalFilesDir(null);
+ File efd = null;
+ try {
+ efd = getApplicationContext().getExternalFilesDir(null);
+ } catch (Exception e) {
+ }
if (efd != null) {
efd.mkdirs();
if (!dictDir.isDirectory() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
dirs += "\n" + f.getAbsolutePath();
}
} else {
- File efd = getApplicationContext().getExternalFilesDir(null);
+ File efd = null;
+ try {
+ efd = getApplicationContext().getExternalFilesDir(null);
+ } catch (Exception e) {
+ }
if (efd != null) {
String externalFilesDir = efd.getAbsolutePath();
if (new File(externalFilesDir).canWrite())