public void onCreate(Bundle savedInstanceState) {
final DictionaryApplication application = (DictionaryApplication) getApplication();
setTheme(application.getSelectedTheme().themeId);
-
+
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
if (prefs.getString(getString(R.string.quickdicDirectoryKey), "").equals("")) {
prefs.edit().putString(getString(R.string.quickdicDirectoryKey), application.getDictDir().getAbsolutePath()).commit();
dirs += "\n" + f.getAbsolutePath();
}
} else {
- String externalFilesDir = getApplicationContext().getExternalFilesDir(null).getAbsolutePath();
- if (new File(externalFilesDir).canWrite())
- dirs += "\n" + externalFilesDir;
+ File efd = null;
+ try {
+ efd = getApplicationContext().getExternalFilesDir(null);
+ } catch (Exception e) {
+ }
+ if (efd != null) {
+ String externalFilesDir = efd.getAbsolutePath();
+ if (new File(externalFilesDir).canWrite())
+ dirs += "\n" + externalFilesDir;
+ }
}
+ File fd = getApplicationContext().getFilesDir();
+ if (fd.canWrite())
+ dirs += "\n" + fd.getAbsolutePath();
new AlertDialog.Builder(this).setTitle(getString(R.string.error))
.setMessage(getString(R.string.chosenNotWritable) + dirs)
.setNeutralButton("Close", null).show();