Android应用的开发中对存储的访问非常频繁,但是Android各个版本对存储的支持比较混乱,部分版本甚至没有公开的API支持对扩展存储访问.对Android的内置、外置存储设备进行研究后,提出将存储分为内部存储、外部存储及扩展存储三个类型.分析了各个存储的类型的特点及访问方式,重点讨论了扩展存储的访问方式,提出利用JAVA的反射机制来获取Android平台的扩展存储目录,解决了Android不同版本对存储进行访问的兼容性问题.通过分析工具分析了反射机制在此应用中的效率问题,并在不同Android版本的设备上进行了测试.
In the development of Android application, the access to the storage is extremely frequent, but different versions of Android are in a muddle in supporting storage, with some versions of Android even without public API support for extended storage access. After conducting a study on Android's built-in and external storage devices, we propose to divide storages into three types: internal storage, external storage and extended storage. What's more, we have analyzed the characteristics and access modes of various types of storage, especially the extended storage access mode.We use JAVA reflection mechanism to obtain extended store directory of Android platform. We solve the compatibility problem that different versions of the android access the storage device. Through the analysis tool we have analyzed the efficiency of reflection mechanism in this application, and has tested it on multi-model equipment.