1

When I connect my Nexus 4 to my PC via USB I get a nice set of folders such as Alarms, Downloads, and DCIM. I would really like to access these folders. However, when I use

Environment.getExternalStorageDirectory()

to do so I get /storage/emulated/0 as the returned directory path. When I create a directory or file there I am unable to see them when I browse using my PC. My output popup claims that the folder/file exists but I'm not able to see them. If I do the same thing in my emulator it always defaults to the "SD card" I mounted and I can see the folders fine.

How would I go about accessing and writing to these folders without root access. I've been searching all day, and even found a few new leads while typing this, but no luck.

Thanks

Trikaldarshiii
  • 11,174
  • 16
  • 67
  • 95
soulsabr
  • 895
  • 4
  • 16
  • just reconnect the usb next time you will be able to see – Trikaldarshiii Sep 15 '13 at 06:07
  • Thanks for the reply. I forgot to mention I've done that as well. Did it again just now to be doubly sure my system wasn't having a hiccup and had me asking for no reason. The output I have on my phone verifies either that the folder was created, the folder exists, or that the creation failed. The app is showing the folder as existing (I created it earlier) and spits out the path to it in an alert dialog. Any more ideas? – soulsabr Sep 16 '13 at 01:53
  • OK, so I added code to list the contents of the directory. My code is `code` File dir = Environment.getExternalStorageDirector(); File test = new File(dir.getAbsolutePath() + "/test"); File[] files = dir.listFiles(); AlertDialog ad = new AlertDialog.Builder(this).create(); for(File file : files) { alertDialog.setMessage(file.getAbsolutePath()); /** Button code here **/ alertDialog.show(); } `code` The only thing I see is the test folder. – soulsabr Sep 16 '13 at 02:05
  • Also, I don't think I encased my code correctly. sorry bout that. – soulsabr Sep 16 '13 at 02:13
  • Just at a point now where I'm tinkering with the code. I tried accessing and listing the ringtones folder and the only ringtone that appeared to be on my phone is the default one with the Nexus 4. Why would the folder appear empty rather than listing all of the ringtones that I have? – soulsabr Sep 16 '13 at 04:44
  • Dear GOD in heaven I found the answer. For all who are wondering my problem is caused by an error in the Nexus 4. Here is the link that gives the explanation and various work arounds. http://stackoverflow.com/questions/13737261/nexus-4-not-showing-files-via-mtp. – soulsabr Sep 17 '13 at 04:12

0 Answers0