Android mkdir not making folder -
tonight having issues doing thought simple... making folder in /mnt/sdcard.
i have set follow permission:
<uses-permission android:name="android.permission.write_external_storage"></uses-permission>
my main.java
has following make folder:
public class main extends tabactivity { static int index = 1; private static final string tag = "main"; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); file folder = new file(environment.getexternalstoragedirectory () + "/tallgrass/images"); boolean success = false; if(!folder.exists()){ success = folder.mkdir(); } if (!success){ log.d(tag,"folder not created."); } else{ log.d(tag,"folder created!"); } }
i "folder created!" message in log when check both /mnt/sdcard
, /sdcard
neither 1 has folder. have tried calling:
environment.media_mounted.equals(environment.getexternalstoragestate())
and returns true. can't figure 1 out because signs pointing should work. have tried phone disconnected pc in case sd card mounting or using phone instead of emulator developing. speaking of which, debuggable
true
maybe prevent making folder?
thanks!
does /mnt/sdcard/tallgrass/
directory exist? (i'm guessing not, never know.)
the file.mkdirs()
method create needed directories; mkdir()
create last directory in pathname.
Comments
Post a Comment