Java tutorial
//package com.java2s; /** ** Copyright (C) SAS Institute, All rights reserved. ** General Public License: http://www.opensource.org/licenses/gpl-license.php **/ import android.os.Bundle; public class Main { /** * key used to extract from Bundle a String value, which is message's ID<br> * it is used when transferring a message by a few parcels<br> */ public static final String BUNDLE_SMALL_PARCEL_ID = "smallparcelid"; /** * key used to extract from Bundle an int value, which is the index of parcels of a message<br> * it is used when transferring a message by a few parcels<br> */ public static final String BUNDLE_SMALL_PARCEL_INDEX = "smallparcelindex"; /** * key used to extract from Bundle an int value, which indicates the total number of<br> * parcels of a whole message to be sent.<br> * it is used when transferring a message by a few parcels<br> */ public static final String BUNDLE_SMALL_PARCEL_TOTALNUMBER = "smallparceltotalnumber"; /** * Create a Parcelable Bundle containing 3 parameters: String, int, int for transport from the test package engine.<br> * It will be used by {@link Message#setData(Bundle)} for sending a part of whole message from engine.<br> * The String message is stored via Bundle.putCharArray using {@link #BUNDLE_SMALL_PARCEL_ID} as the key for the item.<br> * The int message is stored via Bundle.putCharArray using {@link #BUNDLE_SMALL_PARCEL_INDEX} as the key for the item.<br> * The int message is stored via Bundle.putCharArray using {@link #BUNDLE_SMALL_PARCEL_TOTALNUMBER} as the key for the item.<br> * * @param ID String, the message's ID. * @param index int, the index of this parcel of the whole message. * @param totalNumber int, indicate the total number of parcels will be sent for a whole message.. * @return Parcelable Bundle * @see Bundle#putCharArray(String, char[]) * @see Bundle#getCharArray(String) * @see #getParcelableIDFromSmallParcel(Parcelable) * @see #getParcelableIndexFromSmallParcel(Parcelable) * @see #getParcelableTotalNumberFromSmallParcel(Parcelable) * @see #isSmallParcelOfWholeMessage(Bundle) */ public static Bundle setBundleOfSmallParcel(String ID, int index, int totalNumber) { Bundle bundle = new Bundle(); bundle.putString(BUNDLE_SMALL_PARCEL_ID, ID); bundle.putInt(BUNDLE_SMALL_PARCEL_INDEX, index); bundle.putInt(BUNDLE_SMALL_PARCEL_TOTALNUMBER, totalNumber); bundle.setClassLoader(Bundle.class.getClassLoader()); return bundle; } }