This article describes the method of Android implementing data in memory to sdcard. Share it for your reference, as follows:
public static void writeToSdCard(String s) { try { File dst = new File("/sdcard/test_sensor/" + mName + ".txt"); File parent = (); if(!()) { (); } FileOutputStream outStream = new FileOutputStream(dst, true); OutputStreamWriter writer = new OutputStreamWriter(outStream, "gb2312"); (s); ("\n"); (); ();// Remember to close (); } catch (Exception e) { ("test result", "file write error"); (); } }
For more information about Android operation sdcard related content, please view the special topic of this site:A summary of SD card operation methods for Android programming and development》
I hope this article will be helpful to everyone's Android programming design.