Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8217665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:32:14+00:00 2026-06-07T12:32:14+00:00

I have ArrayList of object like ArrayList<DataCCHeading>CC1=new ArrayList<DataCCHeading>(); ArrayList<DataCCHeading>hd=new ArrayList<DataCCHeading>(result); for (DataCCHeading dataCCHeading :

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T12:32:17+00:00Added an answer on June 7, 2026 at 12:32 pm

    You do it like this:

      //use getExternalStorageState to determine if there is an sd card
      if (Environment.getExternalStorageState() == null) {
                        directory = new File(Environment.getDataDirectory()
                                + "/RobotiumTestLog/");
                        photoDirectory = new File(Environment.getDataDirectory()
                                + "/Robotium-Screenshots/");
                        /*
                         * this checks to see if there are any previous test photo files
                         * if there are any photos, they are deleted for the sake of
                         * memory
                         */
                         //if the directory exists, delete files in directory
                        if (photoDirectory.exists()) {
                            File[] dirFiles = photoDirectory.listFiles();
                            if (dirFiles.length != 0) {
                                for (int ii = 0; ii <= dirFiles.length; ii++) {
                                    dirFiles[ii].delete();
                                }
                            }
                        }
                        // if no directory exists, create new directory
                        if (!directory.exists()) {
                            directory.mkdir();
                        }
    
                        // if phone DOES have sd card
                    } else if (Environment.getExternalStorageState() != null) {
                        // search for directory on SD card
                        directory = new File(Environment.getExternalStorageDirectory()
                                + "/RobotiumTestLog/");
                        photoDirectory = new File(
                                Environment.getExternalStorageDirectory()
                                        + "/Robotium-Screenshots/");
                        if (photoDirectory.exists()) {
                            File[] dirFiles = photoDirectory.listFiles();
                            if (dirFiles.length > 0) {
                                for (int ii = 0; ii < dirFiles.length; ii++) {
                                    dirFiles[ii].delete();
                                }
                                dirFiles = null;
                            }
                        }
                        // if no directory exists, create new directory to store test
                        // results
                        if (!directory.exists()) {
                            directory.mkdir();
                        }
                    }
    

    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 a bufferedWriter and 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!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a JSON object like this: static ArrayList<item> list = new ArrayList<item>();
i have a ArrayList with ObjectArrays like this: ArrayList<Object[]> objectList = new ArrayList<Object[]>(); i
i have an arraylist and i want to add and remove many items at
I would like to have an arrayList that holds reference to object inside the
I have a list of an object like follows List<ProductInfo> I want to serialize
I have a object type list like List<Object> getRecords = records.getAllRecords(); ArrayList<String> recordsDetail =
ArrayList<Customer> customerList = new ArrayList<Customer>(); // add object to arraylist customerList.add(customer); // get objects
I have an SPListItem object. Can I add a field to store some kind
I have a byte[] that i obtained using Object ArrayList<Obj> Can anyone tell me
I have a listView, populated with an ArrayList of object (xml parsing) and an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.