List of usage examples for android.os Parcel createTypedArray
public final <T> T[] createTypedArray(Parcelable.Creator<T> c)
From source file:Main.java
/** * Repairs the broken tag on HTC devices running Android 5.x * <p/>//from w w w . ja va 2 s.c om * "It seems, the reason of this bug in TechExtras of NfcA is null. However, TechList contains MifareClassic." -bildin * For more information please refer to https://github.com/ikarus23/MifareClassicTool/issues/52#issuecomment-103797115 * <p/> * Code source: https://github.com/ikarus23/MifareClassicTool/issues/52#issuecomment-104277445 * * @param oTag The broken tag * @return The fixed tag */ public static Tag repairTag(Tag oTag) { if (oTag == null) return null; String[] sTechList = oTag.getTechList(); Parcel oParcel, nParcel; oParcel = Parcel.obtain(); oTag.writeToParcel(oParcel, 0); oParcel.setDataPosition(0); int len = oParcel.readInt(); byte[] id = null; if (len >= 0) { id = new byte[len]; oParcel.readByteArray(id); } int[] oTechList = new int[oParcel.readInt()]; oParcel.readIntArray(oTechList); Bundle[] oTechExtras = oParcel.createTypedArray(Bundle.CREATOR); int serviceHandle = oParcel.readInt(); int isMock = oParcel.readInt(); IBinder tagService; if (isMock == 0) { tagService = oParcel.readStrongBinder(); } else { tagService = null; } oParcel.recycle(); int nfca_idx = -1; int mc_idx = -1; for (int idx = 0; idx < sTechList.length; idx++) { if (sTechList[idx].equals(NfcA.class.getName())) { nfca_idx = idx; } else if (sTechList[idx].equals(MifareClassic.class.getName())) { mc_idx = idx; } } if (nfca_idx >= 0 && mc_idx >= 0 && oTechExtras[mc_idx] == null) { oTechExtras[mc_idx] = oTechExtras[nfca_idx]; } else { return oTag; } nParcel = Parcel.obtain(); nParcel.writeInt(id.length); nParcel.writeByteArray(id); nParcel.writeInt(oTechList.length); nParcel.writeIntArray(oTechList); nParcel.writeTypedArray(oTechExtras, 0); nParcel.writeInt(serviceHandle); nParcel.writeInt(isMock); if (isMock == 0) { nParcel.writeStrongBinder(tagService); } nParcel.setDataPosition(0); Tag nTag = Tag.CREATOR.createFromParcel(nParcel); nParcel.recycle(); return nTag; }
From source file:com.cuddlesoft.norilib.SearchResult.java
/** * Re-create a SearchResult by deserializing data from a {@link android.os.Parcel}. * * @param parcel {@link android.os.Parcel} used to deserialize the SearchResult. *///from w w w.ja va 2 s. c o m protected SearchResult(Parcel parcel) { this.images = parcel.createTypedArrayList(Image.CREATOR); this.offset = parcel.readInt(); this.query = parcel.createTypedArray(Tag.CREATOR); this.hasNextPage = (parcel.readByte() == 0x01); }
From source file:com.facebook.notifications.internal.configuration.ActionsConfiguration.java
private ActionsConfiguration(Parcel source) { ClassLoader loader = getClass().getClassLoader(); style = source.readParcelable(loader); layoutStyle = source.readParcelable(loader); background = source.readParcelable(loader); topInset = source.readFloat();// w ww .ja v a2s . c o m contentInset = source.readFloat(); cornerRadius = source.readFloat(); actions = source.createTypedArray(ActionConfiguration.CREATOR); height = source.readFloat(); }
From source file:android.app.FragmentManager.java
public FragmentManagerState(Parcel in) { mActive = in.createTypedArray(FragmentState.CREATOR); mAdded = in.createIntArray(); mBackStack = in.createTypedArray(BackStackState.CREATOR); }
From source file:android.app.Notification.java
/** * Unflatten the notification from a parcel. *//*w w w . j a v a 2 s . c o m*/ public Notification(Parcel parcel) { int version = parcel.readInt(); when = parcel.readLong(); icon = parcel.readInt(); number = parcel.readInt(); if (parcel.readInt() != 0) { contentIntent = PendingIntent.CREATOR.createFromParcel(parcel); } if (parcel.readInt() != 0) { deleteIntent = PendingIntent.CREATOR.createFromParcel(parcel); } if (parcel.readInt() != 0) { tickerText = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel); } if (parcel.readInt() != 0) { tickerView = RemoteViews.CREATOR.createFromParcel(parcel); } if (parcel.readInt() != 0) { contentView = RemoteViews.CREATOR.createFromParcel(parcel); } if (parcel.readInt() != 0) { largeIcon = Bitmap.CREATOR.createFromParcel(parcel); } defaults = parcel.readInt(); flags = parcel.readInt(); if (parcel.readInt() != 0) { sound = Uri.CREATOR.createFromParcel(parcel); } audioStreamType = parcel.readInt(); vibrate = parcel.createLongArray(); ledARGB = parcel.readInt(); ledOnMS = parcel.readInt(); ledOffMS = parcel.readInt(); iconLevel = parcel.readInt(); if (parcel.readInt() != 0) { fullScreenIntent = PendingIntent.CREATOR.createFromParcel(parcel); } priority = parcel.readInt(); kind = parcel.createStringArray(); // may set kind to null if (parcel.readInt() != 0) { extras = parcel.readBundle(); } actions = parcel.createTypedArray(Action.CREATOR); if (parcel.readInt() != 0) { bigContentView = RemoteViews.CREATOR.createFromParcel(parcel); } }