数据存储在我们android开发中是不可避免的,而且,我们也都知道数据存储的方式,文件存储,SharedPreference,数据库存储等。但是应该也有一部分人, 只是知道这些存储方式,或者说只知道怎么用,但是不知道具体被保存在什么地方。本篇文章将详细分析这三种存储方式。
算了不卖关子了,其实,在我看来数据存储,或者说数据的持久化,就分为两类。内部存储,外部存储。
/**
* Returns the absolute path to the directory on the filesystem where files
* created with {@link #openFileOutput} are stored.
*
* The returned path may change over time if the calling app is moved to an
* adopted storage device, so only relative paths should be persisted.
*
* No additional permissions are required for the calling app to read or
* write files under the returned path.
*
* @return The path of the directory holding application files.
* @see #openFileOutput
* @see #getFileStreamPath
* @see #getDir
*/
public abstract File getFilesDir();