Package icyllis.modernui.util
Interface Parcelable
- All Known Subinterfaces:
ParcelableSpan
- All Known Implementing Classes:
AbsoluteSizeSpan
,AlignmentSpan.Standard
,BackgroundColorSpan
,DataSet
,Editor.EditOperation
,ForegroundColorSpan
,LeadingMarginSpan.Standard
,LineBackgroundSpan.Standard
,LocaleSpan
,RelativeSizeSpan
,StrikethroughSpan
,StyleSpan
,SubscriptSpan
,SuperscriptSpan
,TrailingMarginSpan.Standard
,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 interface
Specialization ofParcelable.Creator
that allows you to receive theClassLoader
the object is being created in.static interface
Interface that must be implemented and provided as a public CREATOR field that creates instances of yourParcelable
class from aParcel
.static @interface
-
Method Summary
Modifier and TypeMethodDescriptionvoid
writeToParcel
(Parcel dest, int flags) The subclass implements the method to flatten its contents by calling the methods ofParcel
for its primitive values.
-
Method Details
-
writeToParcel
The subclass implements the method to flatten its contents by calling the methods ofParcel
for its primitive values.- Parameters:
dest
- the parcel to write the object's data toflags
- the flags about how the object should be written
-