List of usage examples for android.os Parcel readIntArray
public final void readIntArray(int[] val)
From source file:Main.java
/** * Repairs the broken tag on HTC devices running Android 5.x * <p/>//from ww w. ja v a2 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:android.support.design.internal.ParcelableSparseArray.java
public ParcelableSparseArray(Parcel source, ClassLoader loader) { super();/*from w ww .j a va 2 s.com*/ int size = source.readInt(); int[] keys = new int[size]; source.readIntArray(keys); Parcelable[] values = source.readParcelableArray(loader); for (int i = 0; i < size; ++i) { put(keys[i], values[i]); } }
From source file:net.soulwolf.structure.core.FragmentParameter.java
public FragmentParameter(Parcel in) { mFragmentClass = (Class) in.readSerializable(); mParams = in.readBundle();/*from w ww . j a v a2 s . c o m*/ mTag = in.readString(); mRequestCode = in.readInt(); mResultCode = in.readInt(); int size = in.readInt(); mAnimationRes = new int[size]; in.readIntArray(mAnimationRes); mResultParams = in.readParcelable(getClass().getClassLoader()); }