Parcel readSerializable - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Parcel readSerializable method.

This code example shows how to use the following methods:readInt, readList, readSerializable, readString
     * 
     * @param in The parcel information to recreate the object 
     */ 
    private void readFromParcel(Parcel in) {
        //- 0 
        int hasSearchDirectory = in.readInt();
        if (hasSearchDirectory == 1) {
            this.mSearchDirectory = in.readString();
        } 
        //- 1 
        int hasSearchResultList = in.readInt();
        if (hasSearchResultList == 1) {
            List<SearchResult> searchResultList = new ArrayList<SearchResult>();
            in.readList(searchResultList, SearchInfoParcelable.class.getClassLoader());
            this.mSearchResultList = new ArrayList<SearchResult>(searchResultList);
        } 
        //- 2 
        int hasSearchQuery = in.readInt();
        if (hasSearchQuery == 1) {
            this.mSearchQuery = (Query)in.readSerializable();

7
CodeRank
This code example shows how to use the following methods:readBundle, readByte, readSerializable
	 * PARCELLABLE INTERFACE. 
	 *  
	 * Constructor, using a Parcel as source. 
	 */ 
	private BackupFileDetails(Parcel in) {
		mFile = (File) in.readSerializable();
		byte infoFlag = in.readByte();
		if (infoFlag != (byte)0) {
			mInfo = new BackupInfo(in.readBundle());
		} else { 
			mInfo = null;
		} 
	} 
 
	/** 
	 * PARCELLABLE INTERFACE. 
	 *  
	 * Need a CREATOR 
	 */ 
	public static final Parcelable.Creator<BackupFileDetails> CREATOR = new Parcelable.Creator<BackupFileDetails>() {
7
CodeRank
This code example shows how to use the following methods:readBundle, readInt, readSerializable, readString
public class FragmentElement implements Parcelable {
    public final static String BUNDLE = "info";
     
    public static final Parcelable.Creator<FragmentElement> CREATOR = new Parcelable.Creator<FragmentElement>() {
        public FragmentElement createFromParcel(Parcel in) { 
            return new FragmentElement(in.readString(), in.readInt(), (Class<?>)in.readSerializable(), in.readBundle()); 
        } 
        public FragmentElement[] newArray(int size) { 
            return new FragmentElement[size]; 
        } 
    }; 
 
    public final String name;
    public final int icon;
    public Class<?>  clazz;
    public final Bundle args;
    public Fragment fragment;
 
    public FragmentElement(String name, Class<?> clazz, Bundle args) {
        this(name, -1, clazz, args);
6
CodeRank
This code example shows how to use the following methods:readInt, readParcelable, readSerializable, readStringList
	private Notification syncServiceRunningNotification;
	 
	private Notification syncServiceCompletedNotification;
	 
	/* package */ SyncIntentServiceRequest(Parcel in) {
		this.syncRequestOperation = (SyncRequestOperation) in.readSerializable();
		this.syncFiles = in.readInt() == 1 ? true : false;
		 
		boolean hasTablesToSync = in.readInt() == 1 ? true : false;
		 
		List<String> tablesToSync = new ArrayList<String>();
		in.readStringList(tablesToSync);
		 
		this.tablesToSync = hasTablesToSync ? tablesToSync : null;
		 
		this.syncServiceRunningNotification = in.readParcelable(SyncIntentServiceRequest.class.getClassLoader());
		this.syncServiceCompletedNotification = in.readParcelable(SyncIntentServiceRequest.class.getClassLoader());
	} 
	 
	/* package */ SyncIntentServiceRequest(SyncRequestOperation syncOperation) {

6
CodeRank
This code example shows how to use the following methods:readInt, readList, readSerializable, readString
     * 
     * @param in The parcel information to recreate the object 
     */ 
    private void readFromParcel(Parcel in) {
        //- 0 
        int hasSearchDirectory = in.readInt();
        if (hasSearchDirectory == 1) {
            this.mSearchDirectory = in.readString();
        } 
        //- 1 
        int hasSearchResultList = in.readInt();
        if (hasSearchResultList == 1) {
            List<SearchResult> searchResultList = new ArrayList<SearchResult>();
            in.readList(searchResultList, SearchInfoParcelable.class.getClassLoader());
            this.mSearchResultList = new ArrayList<SearchResult>(searchResultList);
        } 
        //- 2 
        int hasSearchQuery = in.readInt();
        if (hasSearchQuery == 1) {
            this.mSearchQuery = (Query)in.readSerializable();

6
CodeRank
This code example shows how to use the following methods:readParcelable, readSerializable
		out.writeSerializable(dataId);
		out.writeParcelable(data, flag);
	} 
	 
	private void readFromParcel(Parcel in) {
		dataId = (DataIdentifier) in.readSerializable();
		data = (E) in.readParcelable(this.getClass().getClassLoader());
	} 
	 
	public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
		public DataWrapper createFromParcel(Parcel in) { 
			return new DataWrapper(in); 
		} 
 
		public DataWrapper[] newArray(int size) { 
			return new DataWrapper[size]; 
		} 
	}; 
} 
6
CodeRank
This code example shows how to use the following methods:readInt, readSerializable, readString
      return new RemoteDevice[size]; 
    } 
  }; 
 
  private RemoteDevice(Parcel parcel) {
    this(parcel.readString(), (InetAddress) parcel.readSerializable(),
        parcel.readInt());
  } 
} 
6
CodeRank
This code example shows how to use the following methods:readSerializable, readString
  private final Type type;
  /** Raw class. */ 
  private final Class<?> rawClass;
 
  ModelTypeToken(final Parcel in) {
    this.type = (Type)in.readSerializable();
    final String modelClassName = in.readString();
    try { 
      this.rawClass = Class.forName(modelClassName);
    } catch (final Exception e) {
      throw new RuntimeException("Cannot load raw class for model type token", e);
    } 
  } 
 
  private ModelTypeToken(final Class<?> clazz) {
    this(getType(clazz));
  } 
 
  private ModelTypeToken(final Type type) {
    this.type = type;
6
CodeRank
This code example shows how to use the following methods:readSerializable, readString
     */ 
    public static final Creator<NetworkInfo> CREATOR =
        new Creator<NetworkInfo>() { 
            public NetworkInfo createFromParcel(Parcel in) { 
                NetworkInfo netInfo = new NetworkInfo( 
                        in.readString(), /*operatorAlphaLong*/ 
                        in.readString(), /*operatorAlphaShort*/ 
                        in.readString(), /*operatorNumeric*/ 
                        (State) in.readSerializable()); /*state*/ 
                return netInfo; 
            } 
 
            public NetworkInfo[] newArray(int size) { 
                return new NetworkInfo[size]; 
            } 
        }; 
} 
5
CodeRank
This code example shows how to use the following methods:readSerializable, readString
     */ 
    public static final Creator<OperatorInfo> CREATOR =
        new Creator<OperatorInfo>() { 
            public OperatorInfo createFromParcel(Parcel in) { 
                OperatorInfo opInfo = new OperatorInfo( 
                        in.readString(), /*operatorAlphaLong*/ 
                        in.readString(), /*operatorAlphaShort*/ 
                        in.readString(), /*operatorNumeric*/ 
                        (State) in.readSerializable()); /*state*/ 
                return opInfo; 
            } 
 
            public OperatorInfo[] newArray(int size) { 
                return new OperatorInfo[size]; 
            } 
        }; 
} 
5
CodeRank

Related Parcel readSerializable Questions & Answers:

readSerializable Method Overview
Read and return a new Serializable object from the parcel.
See Code Examples for other Android Parcel Methods: