Example usage for android.os Parcel dataSize

List of usage examples for android.os Parcel dataSize

Introduction

In this page you can find the example usage for android.os Parcel dataSize.

Prototype

public final int dataSize() 

Source Link

Document

Returns the total amount of data contained in the parcel.

Usage

From source file:org.chromium.chrome.browser.util.IntentUtils.java

/**
 * Returns how large the Intent will be in Parcel form, which is helpful for gauging whether
 * Android will deliver the Intent instead of throwing a TransactionTooLargeException.
 *
 * @param intent Intent to get the size of.
 * @return Number of bytes required to parcel the Intent.
 *//*from ww  w.jav a2  s  .c  o m*/
public static int getParceledIntentSize(Intent intent) {
    Parcel parcel = Parcel.obtain();
    intent.writeToParcel(parcel, 0);
    return parcel.dataSize();
}

From source file:io.bunnyblue.noticedog.app.notifications.Notification.java

void logParcelSize(Parcel p) {
    Log.d(TAG, "Notification {");
    Log.d(TAG, "    packageName = " + this.packageName);
    Log.d(TAG, "    id = " + this.id);
    Log.d(TAG, "    tag = " + this.tag);
    Log.d(TAG, "    when = " + this.when);
    Log.d(TAG, "}  parcel size in bytes = " + p.dataSize());
}