I have ArrayList of object like
ArrayList<DataCCHeading>CC1=new ArrayList<DataCCHeading>();
ArrayList<DataCCHeading>hd=new ArrayList<DataCCHeading>(result);
for (DataCCHeading dataCCHeading : hd)
{
if(dataCCHeading.Ownername==TAG_CC1HeadingData)
{
CC1.add(dataCCHeading);
}
}
What I want to do to store external storage SDCard so that I can later get that data other wise I have to request it again from server. My question is how to store Arraylist of object to store and retrieve from SDCard?
You do it like this:
It is a pretty easy process. What I did here was check to see if there is an SD card, if there is, I search for a directory, if no directory, I create one. If there is a directory and it has content I erase it. You don’t have to do all that. If you like, you can use the the
Environment.getExternalStorageDirectory(). This will get the SD card. From there you create abufferedWriterand write. You also need to add<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />in your manifest. If you have any questions, let me know.I hope this helps!