Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//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";

    /**
     * Test is the bundle contains the information of small parcel of a whole message.<br>
     * 
     * @param dataBundle, Bundle, get from the data property of a Message object.
     * @return boolean, true, if the dataBundle contains the information of small parcel.
     * @see #setBundleOfSmallParcel(String, int, int)
     * @see #getParcelableIDFromSmallParcel(Parcelable)
     * @see #getParcelableIndexFromSmallParcel(Parcelable)
     * @see #getParcelableTotalNumberFromSmallParcel(Parcelable)
     */
    public static boolean isSmallParcelOfWholeMessage(Bundle dataBundle) {
        return (dataBundle != null && dataBundle.containsKey(BUNDLE_SMALL_PARCEL_ID)
                && dataBundle.containsKey(BUNDLE_SMALL_PARCEL_INDEX)
                && dataBundle.containsKey(BUNDLE_SMALL_PARCEL_TOTALNUMBER));
    }
}