I am basically trying to save a String to a specific folder I create on the internal storage of my phone when I click the button save. I am still a noob at these stuff therefore I do not know what to do. I want to access the file using the file manager and not through the application I created. So I need help with: 1- Create the folder. 2- Save the string to that specific folder. Any help is appreciated and thank you in advance.
Save.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//Toast.makeText(getApplicationContext(), ("X values: "+mg1.getXs()) ,Toast.LENGTH_LONG).show();
//Toast.makeText(getApplicationContext(), SENSOR_READING_STRING ,Toast.LENGTH_LONG).show();
String filename = "Data.txt";
String ABCD_STRING = "SENSOR_READING_STRING";
FileOutputStream outputStream;
try {
outputStream = openFileOutput(filename, Context.MODE_PRIVATE);
outputStream.write(ABCD_STRING.getBytes());
outputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
});