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 8642185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:42:50+00:00 2026-06-12T11:42:50+00:00

public class Challenge implements Comparable<Challenge>, Serializable { private static final long serialVersionUID = 6970603871560357536L;

  • 0
public class Challenge implements Comparable<Challenge>, Serializable {

private static final long serialVersionUID = 6970603871560357536L;
/* Strings to use for database and server communication */
public static final String CHALLENGE_ID = "cid"; 
public static final String NAME = "name";
public static final String DESCRIPTION = "description";
public static final String TYPE = "type";
public static final String START_DATE = "start_date";
public static final String END_DATE = "end_date";
public static final String GOAL = "goal";
public static final String GROUP_CHALLENGE = "group_challenge";
public static final String ACTIVITY_NAME = "activity_name";
public static final String STATUS = "status";
public static final String USER_POSITION = "user_position";
public static final String USER_VALUE = "user_value";
public static final String NUMBER_OF_PARTICIPANTS = "number_of_participants";
public static final String UNIT_NAME = "unit_name";
public static final String IMAGE_BASE64 = "image_base64";
public static final String USER_GROUPS = "user_groups";
public static final String USER_STATUS = "user_status";
public static final String HAS_MAP = "has_map";
public static final String MAP_ID = "map_id";

public static final int ACTION_ACCEPT = 1;
public static final int ACTION_CANCEL = 2;

public static final int STATUS_PENDING = 0;
public static final int STATUS_ACCEPTED = 1;
public static final int STATUS_DECLINED = 2;
public static final int STATUS_FINISHED = 3;
public static final int STATUS_NOT_FINISHED = 4;

public static final int CHALLENGE_STATUS_ACTIVE = 0;
public static final int CHALLENGE_STATUS_CANCELED = 1;
public static final int CHALLENGE_STATUS_FINISHED = 2;

public static final int CHALLENGE_TYPE_FIRST_TO_GOAL = 0;
public static final int CHALLENGE_TYPE_UNLIMITED_GOAL = 1;

/* Fields */
private int cid;
private String name;
private String description;
private int type;
private Date startDate;
private Date endDate;
private double goal;
private boolean groupChallenge;
private String acitivityName;
private int status;
private int userPosition;
private double userValue;
private int numberOfParticipants;
private String unitName;
private Bitmap image;
private int userStatus;
private boolean hasMap;
private int mapId;

private ArrayList<Group> userGroups;



/* Getters and setters */
public int getCid() {
    return cid;
}
public void setCid(int cid) {
    this.cid = cid;
}
public String getName() {
    return name;
}
public void setName(String name) {
    this.name = name;
}
public String getDescription() {
    return description;
}
public void setDescription(String description) {
    this.description = description;
}
public int getType() {
    return type;
}
public void setType(int type) {
    this.type = type;
}
public Date getStartDate() {
    return startDate;
}
public void setStartDate(Date startDate) {
    this.startDate = startDate;
}
public Date getEndDate() {
    return endDate;
}
public void setEndDate(Date endDate) {
    this.endDate = endDate;
}
public double getGoal() {
    return goal;
}
public void setGoal(double goal) {
    this.goal = goal;
}
public String getAcitivityName() {
    return acitivityName;
}
public void setAcitivityName(String acitivityName) {
    this.acitivityName = acitivityName;
}
public int getStatus() {
    return status;
}
public void setStatus(int status) {
    this.status = status;
}
public int getUserPosition() {
    return userPosition;
}
public void setUserPosition(int userPosition) {
    this.userPosition = userPosition;
}
public double getUserValue() {
    return userValue;
}
public void setUserValue(double userValue) {
    this.userValue = userValue;
}
public int getNumberOfParticipants() {
    return numberOfParticipants;
}
public void setNumberOfParticipants(int numberOfParticipants) {
    this.numberOfParticipants = numberOfParticipants;
}
public String getUnitName() {
    return unitName;
}
public void setUnitName(String unitName) {
    this.unitName = unitName;
}
public Bitmap getImage() {
    return image;
}
public void setImage(Bitmap image) {
    this.image = image;
}

This is my code for a model I created “Challenge”. All challenges have an image which is a bitmap, and now I want to save ArrayList to a file in order to save them locally, this is how I save it:

public boolean saveOpenChallenges(List<Challenge> challenges) {
    FileOutputStream fos = null;
    ObjectOutputStream out = null;
    try {
        File new_file = new File(context.getFilesDir(), CHALLENGES_FILE_NAME);
        new_file.createNewFile();
        fos = new FileOutputStream(new_file);
        out = new ObjectOutputStream(fos);
        out.writeObject(challenges);
        out.close();
        Log.d("daim", "saving challenges to file!");
        return true;
    } catch (Exception e) {
        Log.e("bajs", "" + e.getMessage());
        return false;
    } finally {
        close(fos);
    }           
}

This will cast an exception telling me that bitmap is not serializable or something, how I can achieve saving these objects with the bitmap on?
Really appreciate an answer, thanks 🙂

  • 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-12T11:42:52+00:00Added an answer on June 12, 2026 at 11:42 am

    I just saved the image to the SD card instead.

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

Sidebar

Related Questions

public class Knowing { static final long tooth = 343L; static long doIT(long tooth)
public class A { private A(int param1, String param2) {} public static A createFromCursor(Cursor
public class Base{ protected String str; public static final Base ERROR = new Base(error);
I have the following class to test: public abstract class Challenge { protected int
public class Test { public static void main(String[] args) { DemoAbstractClass abstractClass = new
public class Test1<Type> { public Type getCompositeMessage(Type... strings) { Type val = (Type) ;
public class User { public long Id {get;set;} [References(typeof(City))] public long CityId {get;set;} [????]
public class saveButtonListener implements ActionListener{ public void actionPerformed(ActionEvent ev){ JFileChooser chooser= new JFileChooser(); String
I have an activity class as below. public class LoginActivity extends Activity implements OnClickListener
I have an activity class as below. public class LoginActivity extends Activity implements OnClickListener

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.