Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.os.Environment;

import java.io.File;
import java.io.FileOutputStream;

public class Main {

    public static void WriteStringToSD(String fileName, String content) {
        Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
        File file = new File(Environment.getExternalStorageDirectory(), fileName);
        try {
            FileOutputStream fos = new FileOutputStream(file, true);
            fos.write(content.getBytes());
            fos.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}