Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

write in text file android studio

// this function allow you to write in text file
private void writeToFile(String data,Context context) {
        try {
            OutputStreamWriter outputStreamWriter = new OutputStreamWriter(context.openFileOutput("config.txt", Context.MODE_PRIVATE));
            outputStreamWriter.write(data);
            outputStreamWriter.close();
        }
        catch (IOException e) {
            Log.e("Exception", "File write failed: " + e.toString());
        }
    }
 
PREVIOUS NEXT
Tagged: #write #text #file #android #studio
ADD COMMENT
Topic
Name
7+8 =