Make sure you have the WRITE_EXTERNAL_STORAGE permission.
On Mon, Jul 4, 2011 at 6:33 AM, Farhan Khurshid rajafkan...@gmail.com wrote:
I have been trying to fix an issue since yesterday but no luck yet. I
made a very simple android application to create directory and the
application was working fine. The main source code is mentioned here.
File extDir= Environment.getExternalStorageDirectory();
File sddir = new File(extDir+/test10);
if (sddir.mkdirs()) {
Toast toast = Toast.makeText(this,
Directory successfully created!,
Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
}
else{
Toast toast = Toast.makeText(this,
Directory creation failed!,
Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
}
However, yesterday, when I integrated this code to my own application
(a simple videolist that plays videos from the sd-card), the directory
function, for whatever reasons, resulted in directory creation
failed... I debugged the application but couldn't find exception
errors or other errors in it. I don't know what could be wrong.. I am
just wondering if there is any method to get the error statement
behind directory creation failed. I mean if mkdirs failed, it could
generate a small print statement about why it got failed??
any suggestions??
--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy
Android Training in London: http://bit.ly/smand1, http://bit.ly/smand2
--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en