Package icyllis.modernui.util
Interface Parcelable
- All Known Implementing Classes:
AbsoluteSizeSpan,AlignmentSpan.Standard,BackgroundColorSpan,DataSet,Editor.EditOperation,ForegroundColorSpan,LeadingMarginSpan.Standard,LineBackgroundSpan.Standard,LocaleSpan,RelativeSizeSpan,StrikethroughSpan,StyleSpan,SubscriptSpan,SuperscriptSpan,TypefaceSpan,UnderlineSpan,UndoOperation,URLSpan
public interface Parcelable
Parcelable is a serialization method alternative to standard Java
serialization. Instances can be written to and restored from a Parcel,
avoiding the heavy overhead of Externalizable.
Classes implementing the
Parcelable interface must also have a
non-null static field called CREATOR of a type that implements the
Parcelable.Creator or Parcelable.ClassLoaderCreator interface.
A typical implementation of Parcelable is:
public class MyParcelable implements Parcelable {
public static final Parcelable.Creator<MyParcelable> CREATOR
= MyParcelable::new;
private final int mData;
public MyParcelable(@NonNull Parcel src) {
mData = src.readInt();
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeInt(mData);
}
}- Since:
- 3.7
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceSpecialization ofParcelable.Creatorthat allows you to receive theClassLoaderthe object is being created in.static interfaceInterface that must be implemented and provided as a public CREATOR field that creates instances of yourParcelableclass from aParcel.static @interface -
Method Summary
Modifier and TypeMethodDescriptionvoidwriteToParcel(Parcel dest, int flags) The subclass implements the method to flatten its contents by calling the methods ofParcelfor its primitive values.
-
Method Details
-
writeToParcel
The subclass implements the method to flatten its contents by calling the methods ofParcelfor its primitive values.- Parameters:
dest- the parcel to write the object's data toflags- the flags about how the object should be written
-