Use the Activit openfileoutput () method to save the file, the file is placed on the phone on the inside;
Note: The emulator creates a SDcard card image file that can be created in the creation simulator, or in a DOS window for the Android SDK installation path Tools directory, and enter the following command: Mksdcard 2048M D:\AndroidTool\ Sdcard.img
Access to SDcard in your program requires the following permissions :
Create and delete file permissions in SDcard
<uses-permission android:name= "Android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
Write Data permissions in SDcard
<uses-permission android:name= "Android.permission.WRITE_EXTERNAL_STORAGE"/>
public void Savetosdcard (string filename, String filecontent) throws IOException {
File File = new file (environment.getexternalstoragedirectory (), filename);//Get SDcard Path
FileOutputStream OutStream = new FileOutputStream (file);
Outstream.write (Filecontent.getbytes ());
Outstream.close ();
}
// to determine if the SD card exists and can read and write
//if (environment. Getexternalstoragestate (). Equals ( environment.media_mounted)) {
//Fs.savetosdcard (FILENAMESTR, FILECONTENTSTR);
//Toast.maketext (Getapplicationcontext (), r.string.success, 1). Show ();
//} else {
//Toast.maketext (Getapplicationcontext (), R.string.sdcarderror, 1). Show ();
// }