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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:25:23+00:00 2026-05-18T06:25:23+00:00

I have an Object that I need to be able to pass between Activites.

  • 0

I have an Object that I need to be able to pass between Activites. It implements Parcelable and I’ve written all the code related to that.

The problem is that one of the properties of the Object is a Drawable – and really needs to be. Unfortunately, Drawable is neither Parcelable or Serializable. I don’t understand how to pass it.

The reason for having the Drawable is that I need to cache an Image that I’ve downloaded from the internet at runtime. I don’t want to cache the images on the filesystem, since this would potentially end up using up a lot of space over time.

I’m putting the image into a Drawable so that I can easily put it into an ImageView.

Any Ideas?

  • 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-18T06:25:24+00:00Added an answer on May 18, 2026 at 6:25 am

    in your Application:

    HashMap<String,Object> tempObjects = new H....
    
    public Object getTempObject(String key) {
      Object o = null;
      o = tempObjects.get(key);
      tempObjects.remove(key);
    return o;
    }
    
    public void addTempObject(String key, Object object) { 
        tempObjects.put(key, object);
    }
    

    and cast the Object to Drawable on the way back. You may also add a boolean param in the get(), and remove the object from the map if it is true, that way you can access a certain temp object more than once, or remove it immediately if you are sure that you won’t need it anymore in there

    EDIT: sorry for the Exception catch, I pasted the code from a function where I have a HashMap<Class<?>, HashMap<String, Object>> for more detailed temp objects getter, where I am getting one hashMap as a value, and then getting the Object from it, that’s why there was an NPE check in the code that I pasted first

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

Sidebar

Related Questions

I have an object not written by myself that I need to clone in
I have the following code that I need to add an additonal object to
Imagine this case where I have an object that I need to check a
I have a DateTime object that I need to print in a custom gridlike
I have a Queue object that I need to ensure is thread-safe. Would it
I have a NSTimer object that I need to invalidate if a user taps
I have an xml document object that I need to convert into a string.
I have the current basic structure for each domain object that I need to
Hi I have a JSON object that is a 2-dimentional array and I need
I have a string I need to feed to a com object that has

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.