Java Code Examples for android.os.Parcel.writeBundle()

The following are Jave code examples for showing how to use writeBundle() of the android.os.Parcel class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: letv   File: FragmentState.java   View Source Code Vote up 6 votes
public void writeToParcel(Parcel dest, int flags) {
    int i;
    int i2 = 1;
    dest.writeString(this.mClassName);
    dest.writeInt(this.mIndex);
    dest.writeInt(this.mFromLayout ? 1 : 0);
    dest.writeInt(this.mFragmentId);
    dest.writeInt(this.mContainerId);
    dest.writeString(this.mTag);
    if (this.mRetainInstance) {
        i = 1;
    } else {
        i = 0;
    }
    dest.writeInt(i);
    if (!this.mDetached) {
        i2 = 0;
    }
    dest.writeInt(i2);
    dest.writeBundle(this.mArguments);
    dest.writeBundle(this.mSavedFragmentState);
}
 
Example 2
Project: IPCCommunication   File: ClientUtils.java   View Source Code Vote up 6 votes
/**
 * 向服务端发送消息
 * @param code 消息类型
 * @param bundle 消息体
 * @return 返回值为服务器的返回
 * @throws Exception
 */
public Bundle send(int code, Bundle bundle) throws Exception {
    if (mIBinder == null) {
        throw new NullPointerException("IBinder is Null");
    }
    Bundle result = null;
    Parcel _data = Parcel.obtain();
    Parcel _reply = Parcel.obtain();
    try {
        _data.writeInterfaceToken(DESCRIPTOR);
        _data.writeBundle(bundle);
        mIBinder.transact(code,
                _data, _reply, 0);
        _reply.readException();
        result = _reply.readBundle();
    } catch (Exception e) {
        e.printStackTrace();
        throw new Exception(e);
    } finally {
        _reply.recycle();
        _data.recycle();
        return result;
    }
}
 
Example 3
Project: AndroidMuseumBleManager   File: AdRecord.java   View Source Code Vote up 5 votes
@Override
public void writeToParcel(final Parcel parcel, final int arg1) {
    final Bundle b = new Bundle(getClass().getClassLoader());

    b.putInt(PARCEL_RECORD_LENGTH, mLength);
    b.putInt(PARCEL_RECORD_TYPE, mType);
    b.putByteArray(PARCEL_RECORD_DATA, mData);

    parcel.writeBundle(b);
}
 
Example 4
Project: GitHub   File: ParcelUtils.java   View Source Code Vote up 5 votes
public static Parcel writeToParcel(Parcelable instance, String key) {
    Bundle bundle = new Bundle();
    bundle.putParcelable(key, instance);
    
    Parcel parcel = Parcel.obtain();
    parcel.writeBundle(bundle);
    return parcel;
}
 
Example 5
Project: Exoplayer2Radio   File: Station.java   View Source Code Vote up 5 votes
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeParcelable(mStationImage, flags);
    dest.writeString(mStationImageFile.toString());
    dest.writeString(mStationName);
    dest.writeString(mStationPlaylistFile.toString());
    dest.writeParcelable(mStreamUri, flags);
    dest.writeString(mPlaylistFileContent);
    dest.writeBundle(mStationFetchResults);
    dest.writeByte((byte) (mPlayback ? 1 : 0));  // if mPlayback == true, byte == 1
    dest.writeString(mMimeType);
    dest.writeInt(mChannelCount);
    dest.writeInt(mSampleRate);
    dest.writeInt(mBitrate);
}
 
Example 6
Project: DroidIPC   File: BundleReceiver.java   View Source Code Vote up 5 votes
@Override
protected boolean onTransact(int code, Parcel data, Parcel reply, int flags)
		throws RemoteException {
	
	if(code == ServiceContext.TRANSACT_BUNDLE_SENDER) {
		Bundle bundle = data.readBundle();
		Bundle result = onReceiver(bundle);
		reply.writeBundle(result);
	}
	
	return true;
}
 
Example 7
Project: letv   File: PlaybackStateCompat.java   View Source Code Vote up 5 votes
public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(this.mState);
    dest.writeLong(this.mPosition);
    dest.writeFloat(this.mSpeed);
    dest.writeLong(this.mUpdateTime);
    dest.writeLong(this.mBufferedPosition);
    dest.writeLong(this.mActions);
    TextUtils.writeToParcel(this.mErrorMessage, dest, flags);
    dest.writeTypedList(this.mCustomActions);
    dest.writeLong(this.mActiveItemId);
    dest.writeBundle(this.mExtras);
}
 
Example 8
Project: toolargetool   File: TooLargeTool.java   View Source Code Vote up 5 votes
/**
 * Measure the size of a typed {@link Bundle} when written to a {@link Parcel}.
 *
 * @param bundle to measure
 * @return size when written to parcel in bytes
 */
public static int sizeAsParcel(@NonNull Bundle bundle) {
    Parcel parcel = Parcel.obtain();
    try {
        parcel.writeBundle(bundle);
        return parcel.dataSize();
    } finally {
        parcel.recycle();
    }
}
 
Example 9
Project: xlight_android_native   File: Parcelables.java   View Source Code Vote up 5 votes
public static void writeStringMap(Parcel parcel, Map<String, String> stringMap) {
    Bundle b = new Bundle();
    for (Map.Entry<String, String> entry : stringMap.entrySet()) {
        b.putString(entry.getKey(), entry.getValue());
    }
    parcel.writeBundle(b);
}
 
Example 10
Project: boohee_v5.6   File: PlaybackStateCompat.java   View Source Code Vote up 5 votes
public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(this.mState);
    dest.writeLong(this.mPosition);
    dest.writeFloat(this.mSpeed);
    dest.writeLong(this.mUpdateTime);
    dest.writeLong(this.mBufferedPosition);
    dest.writeLong(this.mActions);
    TextUtils.writeToParcel(this.mErrorMessage, dest, flags);
    dest.writeTypedList(this.mCustomActions);
    dest.writeLong(this.mActiveItemId);
    dest.writeBundle(this.mExtras);
}
 
Example 11
Project: GitHub   File: Message.java   View Source Code Vote up 4 votes
@Override
public void writeToParcel (Parcel dest, int flags) {
    dest.writeBundle(data);
}
 
Example 12
Project: GitHub   File: MaterialEditTextPreference.java   View Source Code Vote up 4 votes
@Override public void writeToParcel(@NonNull Parcel dest, int flags) {
    super.writeToParcel(dest, flags);
    dest.writeInt(isDialogShowing ? 1 : 0);
    dest.writeBundle(dialogBundle);
}
 
Example 13
Project: kognitivo   File: ShareMedia.java   View Source Code Vote up 4 votes
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeBundle(params);
}
 
Example 14
Project: aarLibrary   File: ResultRecord.java   View Source Code Vote up 4 votes
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(requestCode);
    dest.writeInt(resultCode);
    dest.writeBundle(resultBundle);
}
 
Example 15
Project: TextView_CustomEdit_CustomColor   File: ColorPickerPreference.java   View Source Code Vote up 4 votes
@Override
public void writeToParcel(Parcel dest, int flags) {
    super.writeToParcel(dest, flags);
    dest.writeBundle(dialogBundle);
}
 
Example 16
Project: MyLife   File: ElasticDrawer.java   View Source Code Vote up 4 votes
@Override
public void writeToParcel(Parcel dest, int flags) {
    super.writeToParcel(dest, flags);
    dest.writeBundle(mState);
}
 
Example 17
Project: letv   File: PlaybackStateCompat.java   View Source Code Vote up 4 votes
public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(this.mAction);
    TextUtils.writeToParcel(this.mName, dest, flags);
    dest.writeInt(this.mIcon);
    dest.writeBundle(this.mExtras);
}
 
Example 18
Project: NeoTerm   File: TabSwitcher.java   View Source Code Vote up 4 votes
@Override
public void writeToParcel(final Parcel dest, final int flags) {
    super.writeToParcel(dest, flags);
    dest.writeSerializable(layoutPolicy);
    dest.writeBundle(modelState);
}
 
Example 19
Project: Cybernet-VPN   File: ElasticDrawer.java   View Source Code Vote up 4 votes
@Override
public void writeToParcel(Parcel dest, int flags) {
    super.writeToParcel(dest, flags);
    dest.writeBundle(mState);
}
 
Example 20
Project: IPCCommunication   File: BaseIPCService.java   View Source Code Vote up 3 votes
/**
 *  处理消息
 * @param code 识别码
 * @param data 调用transact的对象传送过去的参数
 * @param reply 调用onTransact的对象返回的参数
 * @param flags Java里面默认的native方法都是阻塞的,当不需要阻塞的时候设置为IBinder.FLAG_ONEWAY,否则设置为0
 * @return
 * @throws RemoteException
 */
@Override
protected boolean onTransact(final int code, final Parcel data, final Parcel reply, final int flags) throws RemoteException {
    data.enforceInterface(Contant.DESCRIPTOR);
    Bundle bundle = dealMessage(code,data.readBundle());
    reply.writeNoException();
    reply.writeBundle(bundle);
    return true;
}