本文整理汇总了Java中android.os.ParcelFormatException类的典型用法代码示例。如果您正苦于以下问题:Java ParcelFormatException类的具体用法?Java ParcelFormatException怎么用?Java ParcelFormatException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ParcelFormatException类属于android.os包,在下文中一共展示了ParcelFormatException类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeToParcel
import android.os.ParcelFormatException; //导入依赖的package包/类
@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);
}
}
示例2: writeToParcel
import android.os.ParcelFormatException; //导入依赖的package包/类
@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);
}
}
示例3: writeToParcel
import android.os.ParcelFormatException; //导入依赖的package包/类
@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();
}
}
示例4: writeToParcel
import android.os.ParcelFormatException; //导入依赖的package包/类
@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();
}
}
示例5: parseWearActions
import android.os.ParcelFormatException; //导入依赖的package包/类
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!");
}
}