1
0

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 5 years have passed since last update.

[Android]SamsungとLGのEnvironment Class 比較。

Last updated at Posted at 2018-05-16

なに?_

単純な疑問で試してみました。FileのPathが必要で自分が持っているのはLGとSamsungスマホで、
Environment classのmethodの結果の差があるのか!

Kotlinを使ってやろう。

コードは真面目に簡単です。

MainActivity.kt

var envPath = Environment.getDataDirectory().toString()
print("getDataDirectory : ")
println(envPath)
envPath = Environment.getDownloadCacheDirectory().toString()
print("getDownloadCacheDirectory : ")
println(envPath)
envPath = Environment.getRootDirectory().toString()
print("getRootDirectory : ")
println(envPath)
envPath = Environment.getExternalStorageDirectory().toString()
print("getExternalStorageDirectory : ")
println(envPath)
envPath = Environment.getExternalStorageState().toString()
print("getExternalStorageState : ")
println(envPath)

結果。:)

結果は同じだった。

Method Samsung LG
image.png /data /data
image.png /cache /cache
image.png /system /system
image.png /storage/emulated/0 /storage/emulated/0

Code

ここにある

参考。

  1. https://developer.android.com/reference/android/os/Environment
1
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?