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?
in your Application:
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