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

  • SEARCH
  • Home
  • 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 6903095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:52:58+00:00 2026-05-27T07:52:58+00:00

I’m currently working on an Android app that automatically changes the phones state based

  • 0

I’m currently working on an Android app that automatically changes the phones state based on a certain event, such as battery level. I have a Profile class which has 3 main parameters, names, Event and State (Event and State are 2 other custom classes)

In my ProfileEdit class, there are various components such as EditText and Spinner for users to configure a Profile. I need access to an ArrayList of type Profile in a ListActivity class which displays each profile, and my ProfileEdit class which gets the current ArrayList and adds the new profile, or updates one.

The idea I had to do this first was to use ObjectOutputStream to write my ArrayList to the phones sd card, then it can be retrieved by any class that needs it. However my attempts to do this so far just end up throwing an IOException. My code is as follows:

ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("/sdcard/profile.prof"));
oos.writeObject(profiles);
oos.flush();
oos.close();

The profiles object is my ArrayList to be written to the file. I can’t figure out why this is throwing the exception. I tried changing the object to a string by calling writeObject(“Hello”); and that no longer threw the exception, so I can only assume its a problem with the ArrayList. I was under the impression that the ArrayList class implements serializable and my Profile class also implements serializable, although it does the same thing without.

Alternatively, if there’s a better way I can give both my ProfileList (ListActivity) and ProfileEdit classes access to the same ArrayList then please let me know.

Edit: Here’s the IO Exceptions stack trace: (Line 114 of the ProfileEdit class is the writeObject() line)

EZSettings(14788): IO Exception
EZSettings(14788): java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1535)
EZSettings(14788): java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1847)
EZSettings(14788): java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1689)
EZSettings(14788): java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1653)
EZSettings(14788): java.util.ArrayList.writeObject(ArrayList.java:651)
EZSettings(14788): java.lang.reflect.Method.invokeNative(Native Method)
EZSettings(14788): java.lang.reflect.Method.invoke(Method.java:507)
EZSettings(14788): java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1219)
EZSettings(14788): java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1575)
EZSettings(14788): java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1847)
EZSettings(14788): java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1689)
EZSettings(14788): java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1653)
EZSettings(14788): com.ezstatechanger.ProfileEdit.saveState(ProfileEdit.java:114)
EZSettings(14788): com.ezstatechanger.ProfileEdit.access$0(ProfileEdit.java:80)
EZSettings(14788): com.ezstatechanger.ProfileEdit$1.onClick(ProfileEdit.java:72)
EZSettings(14788): android.view.View.performClick(View.java:2538)
EZSettings(14788): android.view.View$PerformClick.run(View.java:9152)
EZSettings(14788): android.os.Handler.handleCallback(Handler.java:587)
EZSettings(14788): android.os.Handler.dispatchMessage(Handler.java:92)
EZSettings(14788): android.os.Looper.loop(Looper.java:123)
EZSettings(14788): android.app.ActivityThread.main(ActivityThread.java:3691)
EZSettings(14788): java.lang.reflect.Method.invokeNative(Native Method)
EZSettings(14788): java.lang.reflect.Method.invoke(Method.java:507)
EZSettings(14788): com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
EZSettings(14788): com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
EZSettings(14788): dalvik.system.NativeStart.main(Native Method)
  • 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-05-27T07:52:58+00:00Added an answer on May 27, 2026 at 7:52 am

    All your objects and all their fields need to be serializable – otherwise they can not be serialized. Another source of IO exception would be lack of permission to write on SD card.
    ( does somebody except your application needs this data? if not, it belongs into provate area.)

    Serializing config data is convenient, but may be bad idea – if your object signature changes, data will be unreadable. Better solution would be to marshall objects into JSON
    and save this file ( Shameless self advertising on: https://github.com/ko5tik/jsonserializer )

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I've got a string that has curly quotes in it. I'd like to replace
I want use html5's new tag to play a wav file (currently only supported
I am currently running into a problem where an element is coming back from
I have a French site that I want to parse, but am running into
We're building an app, our first using Rails 3, and we're having to build
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is

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.