1. Add a function
Try {
File SaveFile = new file ("/sdcard/zhzhg.txt ");
Fileoutputstream outstream = new fileoutputstream (SaveFile );
Try {
Outstream. Write ("file read/write". getbytes ());
}
Catch (ioexception ex)
{
Logger. getlogger (devicelistactivity. Class. getname (). Log (level. Severe, null, ex );
}
Try
{
Outstream. Close ();
}
Catch (ioexception ex)
{
Logger. getlogger (devicelistactivity. Class. getname (). Log (level. Severe, null, ex );
}
}
Catch (filenotfoundexception ex)
{
Logger. getlogger (devicelistactivity. Class. getname (). Log (level. Severe, null, ex );
}
2. Set read and write permissions to the memory card
Add the following content to the androidmainfest. xml file:
<Uses-Permission Android: Name = "android. Permission. write_external_storage"> </uses-Permission>
<Uses-Permission Android: Name = "android. Permission. mount_unmount_filesystems"> </uses-Permission>