Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am trying to save a file to my SDcard on my Samsung Galaxy Nexus running 4.2.2. From my app I am using

Environment.getExternalStorageDirectory()

But it returns

/storage/emulated/0/

Which is not where my SDcard information is located to. Is there any working method I can use to get the correct path to my SDcard?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
214 views
Welcome To Ask or Share your Answers For Others

1 Answer

Actually, that is the correct location.

From android 4,2 onwards, Google introduced multiple user accounts. Every user has his/her own external storage, which has the user ID in the path to maintain uniqueness.

The primary (default) user's ID is 0. So you get /storage/emulated/0/ as the path to the external storage.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...