Android examples for android.os:Environment
save To SD Card
import android.content.Context; import android.content.SharedPreferences; import android.os.Environment; import java.io.*; public class Main{ public static void saveToSDCard(String fileName, String content) throws IOException { File file = new File(Environment.getExternalStorageDirectory(), fileName);/*from w w w . ja v a 2 s . com*/ FileOutputStream fileOutputStream = new FileOutputStream(file); fileOutputStream.write(content.getBytes()); fileOutputStream.close(); } }