Serialized object in intent returning as String

Posted by B_ on Stack Overflow See other posts from Stack Overflow or by B_
Published on 2010-06-16T18:26:52Z Indexed on 2010/06/16 18:32 UTC
Read the original article Hit count: 171

In my application, I am trying to pass a serializable object through an intent to another activity. The intent is not entirely created by me, it is created and passed through a search suggestion.

In the content provider for the search suggestion, the object is created and placed in the SUGGEST_COLUMN_INTENT_EXTRA_DATA column of the MatrixCursor. However, when in the receiving activity I call getIntent().getSerializableExtra(SearchManager.EXTRA_DATA_KEY), the returned object is of type String and I cannot cast it into the original object class.

I tried making a parcelable wrapper for my object that calls out.writeSerializable(...) and use that instead but the same thing happened.

The string that is returned is like a generic Object toString(), i.e. com.foo.yak.MyAwesomeClass@4350058, so I'm assuming that toString() is being called somewhere where I have no control.

Hopefully I'm just missing something simple. Thanks for the help!

© Stack Overflow or respective owner

Related posts about android

Related posts about search