Android - Passing an Object To Another Activity

后端 未结 3 1841
逝去的感伤
逝去的感伤 2021-01-27 06:49

I am utilizing the follow class, which I have as an object: http://pastebin.com/rKmtbDgF

And I am trying to pass it across using:

Intent booklist = new I         


        
3条回答
  •  不思量自难忘°
    2021-01-27 07:30

    Try the following post.

    How can I make my custom objects Parcelable?

    The problem is that the ImageManager is not a parable Object. So that's giving the cast error. If the imageManager is yours you should make the class implement Pracabale like the url above sais.

    EDIT:

    Above should be the right way of doing Parceables, But in your case i really would say you shouldn't pass the ImageManager between different activities. Because the context that your using in the ImageManager class will be disposed.. And you'll certainly get an error.

    So why don't you make a new instance of the class instead and only pass the Bitmap in to it (After transferring the bitmap and other not context related information with the bundle off course.)

提交回复
热议问题