Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.io.BufferedWriter;

import java.io.FileOutputStream;
import java.io.IOException;

import java.io.OutputStreamWriter;

import android.content.Context;

public class Main {

    public static void writeToFile(Context context, String file, String content) throws IOException {
        FileOutputStream fos = context.openFileOutput(file, Context.MODE_PRIVATE);
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos));
        bw.write(content);
        bw.flush();
        bw.close();
        fos.close();
    }
}