java - How can I write an Object to my raw folder file -
this serializable class.
public class person implements serializable{ private string name; private string surname; private int age; public person(string name,string surname,int age){ this.name = name; this.surname = surname; this.age = age; } public void setsurname(string surname) { this.surname = surname; } public void setname(string name) { this.name = name; } public void setage(int age){ this.age = age; } public int getage() { return age; } public string getname() { return name; } public string getsurname() { return surname; } public string tostring(){ return name + " "+surname+" "+age; } }
i trying write person class raw folder using fileoutputstream, nothing working. can't create fileoutputstream, raw folder file.
also tried fileoutputstream.
fileoutputstream fos = getbasecontext().openfileoutput( "android.resource://com.cpt.sample/raw/text.txt",mode_private);
you can't change resource file. static @ run-time. can check here.
and put file @ runtime can use :
- internal storage (or)
- external storage
and directories use : environment.getexternalfilesdir()
fore more information go here.
Comments
Post a Comment