Create a Parcelable Bundle containing a char[] for transport to the test package engine. - Android Android OS

Android examples for Android OS:Parcel

Description

Create a Parcelable Bundle containing a char[] for transport to the test package engine.

Demo Code

/** /*  w w  w  . ja v  a 2 s.c om*/
 ** Copyright (C) SAS Institute, All rights reserved.
 ** General Public License: http://www.opensource.org/licenses/gpl-license.php
 **/
//package com.java2s;
import android.os.Bundle;

import android.os.Parcelable;

public class Main {
    /** key used to extract serialized Properties object from Bundle. */
    public static final String BUNDLE_PROPERTIES = "properties";

    /**
     * Create a Parcelable Bundle containing a char[] for transport to the test package engine.
     * The char[] message is stored via Bundle.putCharArray using {@link #BUNDLE_PROPERTIES} as the key for the item. 
     * The original intent here is to store Java Properties in the Bundle that were serialized via 
     * the Java Properties.store method.<br>
     * NOTE: This has not yet been tested!
     * @param char[] (Properties) to send across processes.
     * @return Parcelable Bundle
     * @see Bundle#putCharArray(String, char[])
     * @see Bundle#getCharArray(String)
     */
    public static Parcelable setParcelableProps(char[] bytes) {
        Bundle bundle = new Bundle();
        bundle.putCharArray(BUNDLE_PROPERTIES, bytes);
        bundle.setClassLoader(Bundle.class.getClassLoader());
        return bundle;
    }
}

Related Tutorials