I am trying to send bean object(implents Serializable
) with 16 strings data obtained from a parser. I am sending that using putExtra("string",serializablevalue)
and I'm receiving that using getIntent().getSerializable("string")
. I have used this option for almost 10 functionalities it works fine for me.But particular this functionality alone always returns me null in receiving location.I have cross checked it while sending.it has value. While in the receiving location.开发者_StackOverflow
My doubt will bean with 16 fields could be sent with this method. Suggest me a better solution for this problem.
Try:
getIntent().getExtras().getSerializable("string")
My code works fine with ArrayList<String>
. Could you please give me/us your serializable-strings?
On the other side, based on this: http://developer.android.com/reference/android/os/Parcelable.html, then if you use custom class, you need to "transfer" the data between: public void writeToParcel(Parcel out, int flags)
and private MyParcelable(Parcel in)
.
In details, you can write your data to out
, and get them from in
.
Check if the String are equals to in both activities!! it happened to me I had one different capital letter, when I corrected it it worked :)
精彩评论