Context.openFileOutput
import java.io.IOException;
import java.io.OutputStreamWriter;
import android.content.Context;
class Common {
public static boolean WriteToFile(Context context, String strContent, String fileName) {
boolean bReturn = true;
OutputStreamWriter osw = null;
try {
// ??????
osw = new OutputStreamWriter(context.openFileOutput(fileName, context.MODE_PRIVATE));
osw.write(strContent);
osw.flush();
} catch (Exception e) {
e.printStackTrace();
bReturn = false;
} finally {
try {
osw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return bReturn;
}
}
Related examples in the same category