?????塢??????洢
???????м???Android???豸??????????????“???洢(external storage)”??????????????????????????????????洢?豸??????SD????????????????????????????洢???????????洢????????????д???
????Sdcard?洢?????(???洢)??
??????????Sdcard?????SDCard?洢???????????????????????
????????Sdcard????????????д??
????д??Sdcard?????????
?????????
????Environment.getExternalStorageState() ??????洢?? //????
????Environment.getExternalStorageDirectory() ??????洢??·?? //
????д?????洢?????
????android.permission.MOUNT_UNMOUNT_FILESYSTEMS //?????ж???????
????android.permission.WRITE_EXTERNAL_STORAGE //д???洢???
????android.permission.READ_EXTERNAL_STORAGE //?????洢?????
??????android 4.0?????????????洢??·?????淶????????????
???????洢·??????
????1.???????????????洢·??
?????????Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
????/mnt/sdcard/downloads/
????2.??????д??????????????????????????????д?????????????????????????? ??
?????????context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS)
??????/mnt/sdcard/android/data/<????>/files/<????>/
????3.??????д????????л?????? ??????????????????????????
???????: context.getExternalCacheDir()
?????? /mtn/sdcard/android/data/<????>/cache
????4.????????·??
?????????Environment.getExternalStorageDirectory()
????/mnt/sdcard
????????SharedPreferences :???????????洢
????SharedPreferences????????????????????洢?????
??????xml??????????????????????????????????
?????????????????ints??floats??boolean??strings??longs??Set<String>(android 11???)????
???????λ???/data/data/<????>/shared_prefs?????????????е??????
????????????????????????????????????????
??????????SharedPreferences????
????context.getSharedPreferences(name??Mode)
???????????SharedPreferences????????????洢???????????????????????xml?????
????name ??????????????д????????????*.xml :?????????????
????mode :??android 4.0?汾 ???????mode_private
????Activity.getPreferences(name)
????name ?????????????????Activity??????????????
????get values
????SharedPreferences.getString(key??defvalue) ??????????????????????key??????????? defvule ?? null
????SharedPreferences.getInt(key??defvalue) ?????????????????????key??????????? defvule ?? 0
????SharedPreferences.getBoolean(key??defvalue) ??????????????????????key??????????? defvule ?? false
????save values
?????????裺
?????????? Editor editor=SharedPreferences.edit()
????editor.putString(key??value)
????editor.putInt(key??value)
????editor.putBoolean(key??value)
????editor.commit();//???????????????????μ?xml?????
????С???? ??????SharedPreferences?????????????
???????
????1.?????????????????????????Activity??SystemActivity
????2.??и???????????????????????????????SharedPreferences?洢xml?????
????3.????′??????????洢?????????????????????????????????
????4.?????SharedPreference????????????
????des ???????? ?? ?????????????????? ???????????????
????aes ??des?????
???????
??????
??????????洢????????洢
????SharedPrefenrencs
?????????
????SharedPrefenrencs
????FileStore ????? ??sdcard??????
??????