Sorry, this might be quite a lengthy question, but how do i actually save int/byte/string data types in Android?
I do know that to save a String into the internal memory (note, not external or anything else), i have to do something like this:
String FILENAME = "hello_file";
String string = "hello world!";
FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);
fos.write(string.getBytes());
fos.close();
to save the file, and:
int saveTest = fos.read();
fos.close();
to read the file from another activity or something. (Is this correct?)
But what if i want to save and read the file as an int/byte data file? Is this possible? And how would i be able to do it?
To save your objects you can use the ObjectOutput class to serialize them, e.g.:
Where the class Example could be any object that implements serializable or byte data, the javadocs may also help!
Hope this helps!