1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Androidで"storage/emulated/0/"直下にアクセスしてファイルを保存

Posted at

#はじめに
androidでファイルを保存したいとき、ユーザーがアクセス可能なルートディレクトリ("storage/emulated/0/")に保存すると何かと便利。
そこでファイルアクセス方法を調べてみた。

#現在は非推奨
以前(Android10以前)ではEnvironment.getExternalStorageDirectory()を使用して外部パブリックストレージへのパスを取得できた。
しかし現在では非推奨となり使用できない。

https://nagare-it.com/115/
https://nagare-it.com/121/
http://blog.lciel.jp/blog/2014/02/08/android-about-storage/

#推奨方法

  1. Context#getExternalFilesDir(String)
  2. MediaStore
  3. Intent#ACTION_OPEN_DOCUMENT.
1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?