android write to sdcard

android to sdcard

Android write to sd-card

Below is the snippet to write into the sd-card. Some devices may not contain the sd-card. So basically we are writing in to user visible space.
String  ROOT_DIR_NAME = "appdir";
File root = 
android.os.Environment.getExternalStorageDirectory(); //for sdcard
File rootdir = new File (root.getAbsolutePath() + "/"+ROOT_DIR_NAME+"/"); //it is my root directory
if(rootdir.exists()==false)  
{  
    rootdir.mkdirs();  
    Log.wtf("SKDINFO","folder created");  
}

Comments