ElementNameEx, IntentAgentEx, PacMapEx, RemoteViewExpublic interface ParcelableEx
marshallingEx(ohos.utils.Parcel) method to marshal data into the Class name+data format.
Sample code:
public class Example implements ParcelableEx {
private int data = 0;
@override
public void marshallingEx(Parcel out) {
out.writeString(getClass().getName());
out.writeInt(data);
return;
}
}
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
marshallingEx(Parcel out) |
Writes a
ParcelableEx object into a Parcel. |
default void |
unmarshallingEx(Parcel in) |
Unmarshalls this
ParcelableEx object from a Parcel. |
void marshallingEx(Parcel out) throws ParcelException
ParcelableEx object into a Parcel.out - Indicates the Parcel object to which the ParcelableEx object will be written.ParcelException - Throws this exception if the operation fails.default void unmarshallingEx(Parcel in) throws ParcelException
ParcelableEx object from a Parcel.
To achieve successful data unmarshalling,
you must provide a no-argument constructor for the class that inherits the ParcelableEx
interface and write the class name to Parcel in the marshallingEx(ohos.utils.Parcel) method.
in - Indicates the Parcel object from which the ParcelableEx object will be unmarshaled.ParcelException - Throws this exception if the operation fails.