Does anyone know where/when this method of a Parcelable is called?
@Override
public int describeContents() {
return 0;
}
It has to be overriden. But should I consider doing something useful with it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
There is a constant defined in
ParcelablecalledCONTENTS_FILE_DESCRIPTORwhich is meant to be used indescribeContents()to create bitmask return value.Description for
CONTENTS_FILE_DESCRIPTORin the API ref is:Which really means: If you need to put
FileDescriptorobject into Parcelable you should/must specifyCONTENTS_FILE_DESCRIPTORas return value of describeContents(), i.e. by “special object” (indescribeContents()‘s description) they really mean:FileDescriptor.This whole Parcelable functionality looks unfinished (read: has bad design). There is one other strange thing in the docs:
Implementing multiple inheritance by rules defined in human readable form? 🙂
It seems like C++ programmer designed
Parceableand at some point he realized: Oh, damn, there is no multiple inheritance in Java… 🙂