Java 类android.os.ParcelFormatException 实例源码

项目:GitHub    文件:Entry.java   
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeFloat(this.x);
    dest.writeFloat(this.getY());
    if (getData() != null) {
        if (getData() instanceof Parcelable) {
            dest.writeInt(1);
            dest.writeParcelable((Parcelable) this.getData(), flags);
        } else {
            throw new ParcelFormatException("Cannot parcel an Entry with non-parcelable data");
        }
    } else {
        dest.writeInt(0);
    }
}
项目:Stayfit    文件:Entry.java   
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeFloat(this.mVal);
    dest.writeInt(this.mXIndex);
    if (mData != null) {
        if (mData instanceof Parcelable) {
            dest.writeInt(1);
            dest.writeParcelable((Parcelable) this.mData, flags);
        } else {
            throw new ParcelFormatException("Cannot parcel an Entry with non-parcelable data");
        }
    } else {
        dest.writeInt(0);
    }
}
项目:NetKnight    文件:Entry.java   
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeFloat(this.mVal);
    dest.writeInt(this.mXIndex);
    if (mData != null) {
        if (mData instanceof Parcelable) {
            dest.writeInt(1);
            dest.writeParcelable((Parcelable) this.mData, flags);
        } else {
            throw new ParcelFormatException("Cannot parcel an Entry with non-parcelable data");
        }
    } else {
        dest.writeInt(0);
    }
}
项目:JNChartDemo    文件:Entry.java   
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeFloat(this.mVal);
    dest.writeInt(this.mXIndex);
    if (mData != null) {
        if (mData instanceof Parcelable) {
            dest.writeInt(1);
            dest.writeParcelable((Parcelable) this.mData, flags);
        } else {
            throw new ParcelFormatException("Cannot parcel an Entry with non-parcelable data");
        }
    } else {
        dest.writeInt(0);
    }
}
项目:Firebase-Chat-Demo    文件:User.java   
@Override
public void writeToParcel(Parcel parcel, int i) {
    try {
        parcel.writeString(this.uid);
        parcel.writeString(this.name);
        parcel.writeString(this.image);
        parcel.writeString(this.email);
        parcel.writeLong(this.lastSeen);
        parcel.writeString(this.fcm);
    } catch (ParcelFormatException e) {
        e.printStackTrace();
    }
}
项目:Firebase-Chat-Demo    文件:Conversation.java   
@Override
public void writeToParcel(Parcel parcel, int i) {
    try {
        parcel.writeString(this.uid);
        parcel.writeString(this.name);
        parcel.writeString(this.image);
        parcel.writeString(this.message);
        parcel.writeString(this.time);
    } catch (ParcelFormatException e) {
        e.printStackTrace();
    }
}
项目:xs-android-architecture    文件:Entry.java   
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeFloat(this.x);
    dest.writeFloat(this.getY());
    if (getData() != null) {
        if (getData() instanceof Parcelable) {
            dest.writeInt(1);
            dest.writeParcelable((Parcelable) this.getData(), flags);
        } else {
            throw new ParcelFormatException("Cannot parcel an Entry with non-parcelable data");
        }
    } else {
        dest.writeInt(0);
    }
}
项目:TripV1.0    文件:User.java   
@Override
public void writeToParcel(Parcel parcel, int i) {
    try {
        parcel.writeString(this.uid);
        parcel.writeString(this.name);
        parcel.writeString(this.image);
        parcel.writeString(this.email);
        parcel.writeLong(this.lastSeen);
        parcel.writeString(this.fcm);
    } catch (ParcelFormatException e) {
        e.printStackTrace();
    }
}
项目:TripV1.0    文件:Conversation.java   
@Override
public void writeToParcel(Parcel parcel, int i) {
    try {
        parcel.writeString(this.uid);
        parcel.writeString(this.name);
        parcel.writeString(this.image);
        parcel.writeString(this.message);
        parcel.writeString(this.time);
    } catch (ParcelFormatException e) {
        e.printStackTrace();
    }
}
项目:LETO-Toggl_Android    文件:Entry.java   
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeFloat(this.x);
    dest.writeFloat(this.getY());
    if (getData() != null) {
        if (getData() instanceof Parcelable) {
            dest.writeInt(1);
            dest.writeParcelable((Parcelable) this.getData(), flags);
        } else {
            throw new ParcelFormatException("Cannot parcel an Entry with non-parcelable data");
        }
    } else {
        dest.writeInt(0);
    }
}
项目:QuShuChe    文件:Entry.java   
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeFloat(this.mVal);
    dest.writeInt(this.mXIndex);
    if (mData != null) {
        if (mData instanceof Parcelable) {
            dest.writeInt(1);
            dest.writeParcelable((Parcelable) this.mData, flags);
        } else {
            throw new ParcelFormatException("Cannot parcel an Entry with non-parcelable data");
        }
    } else {
        dest.writeInt(0);
    }
}
项目:dailyJournal    文件:Entry.java   
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeFloat(this.mVal);
    dest.writeInt(this.mXIndex);
    if (mData != null) {
        if (mData instanceof Parcelable) {
            dest.writeInt(1);
            dest.writeParcelable((Parcelable) this.mData, flags);
        } else {
            throw new ParcelFormatException("Cannot parcel an Entry with non-parcelable data");
        }
    } else {
        dest.writeInt(0);
    }
}
项目:MPAndroidChart    文件:Entry.java   
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeFloat(this.x);
    dest.writeFloat(this.getY());
    if (getData() != null) {
        if (getData() instanceof Parcelable) {
            dest.writeInt(1);
            dest.writeParcelable((Parcelable) this.getData(), flags);
        } else {
            throw new ParcelFormatException("Cannot parcel an Entry with non-parcelable data");
        }
    } else {
        dest.writeInt(0);
    }
}
项目:PebbleNotificationCenter-Android    文件:ActionParser.java   
public static void parseWearActions(Context context, Notification notification, PebbleNotification pebbleNotification, List<NotificationAction> storage)
{
    try
    {
        if (storage.size() >= NotificationAction.MAX_NUMBER_OF_ACTIONS)
            return;

        Bundle extras = NotificationTextParser.getExtras(notification);

        if (extras.containsKey("android.wearable.EXTENSIONS"))
        {
            Bundle wearExtras = extras.getBundle("android.wearable.EXTENSIONS");

            if (wearExtras.containsKey("actions"))
            {
                ArrayList<?> actionList = (ArrayList<?>) wearExtras.get("actions");
                for (Object obj : actionList)
                {
                    if (storage.size() >= NotificationAction.MAX_NUMBER_OF_ACTIONS)
                        break;

                    NotificationAction action = null;

                    if (obj instanceof  Bundle)
                        action = WearVoiceAction.parseFromBundle((Bundle) obj);
                    else if (obj instanceof Notification.Action)
                        action = WearVoiceAction.parseFromAction((Notification.Action) obj);

                    if (action != null)
                        storage.add(action);
                }
            }

            if (storage.size() >= NotificationAction.MAX_NUMBER_OF_ACTIONS)
                return;

            if (wearExtras.containsKey("pages"))
            {
                Parcelable[] pages = wearExtras.getParcelableArray("pages");
                int counter = 1;
                for (Parcelable page : pages)
                {
                    if (storage.size() >= NotificationAction.MAX_NUMBER_OF_ACTIONS)
                        return;

                    PebbleNotification pageNotification = NotificationHandler.getPebbleNotificationFromAndroidNotification(context, new NotificationKey(pebbleNotification.getKey().getPackage(), null, null), (Notification) page, false);
                    if (pageNotification == null)
                        continue;

                    pageNotification.setForceSwitch(true);
                    pageNotification.setText(TextUtil.trimStringFromBack(pageNotification.getText(), NotificationSendingModule.getMaximumTextLength(pebbleNotification.getSettingStorage(context))));

                    storage.add(new NotifyAction(context.getString(R.string.wearPageAction, counter), pageNotification));

                    counter++;
                }
            }
        }
    }
    catch (ParcelFormatException e) //Some phones (or apps?) seems to throw this when unparceling data.
    {
        Timber.w("Got ParcelFormatException at parseWearActions!");
    }
}