well basically I want to do this,
class myclass
{
int a1;
float b1;
char c1; //This is a single character
}
List<myclass> obs;
now at run-time this obs variable as it is a list will contain array of the myclass instances
whose size we get obs.size();
So, how to write this data to file say “data1.bin” as binary using OutputStream or some thing similar. But this is to be done in Android OS.
I did something like this in c++ like
class myclass
{
int a1;
float b1;
char c1;
}
myclass student1;
ofstream output_file("students.data", ios::binary);
output_file.write((char*)&student1, sizeof(student1));
output_file.close()
But How to do this in Android OS?
if you want to dump your class to file, let the class implement Serializable and java (or Dalvik VM on android) will do this for you behind the scene.