Example usage for android.view.accessibility AccessibilityEvent CREATOR

List of usage examples for android.view.accessibility AccessibilityEvent CREATOR

Introduction

In this page you can find the example usage for android.view.accessibility AccessibilityEvent CREATOR.

Prototype

Parcelable.Creator CREATOR

To view the source code for android.view.accessibility AccessibilityEvent CREATOR.

Click Source Link

Usage

From source file:Main.java

/**
 * Returns a cached instance if such is available or a new one is created.
 * The returned instance is initialized from the given <code>event</code>.
 *
 * @param event The other event.//from   w w  w  .  j  a  v  a  2  s.  c om
 * @return An instance.
 */
public static AccessibilityEvent obtain(AccessibilityEvent event) {
    final Parcel parcel = Parcel.obtain();

    // Write the event to the parcel and reset the data pointer.
    event.writeToParcel(parcel, 0);
    parcel.setDataPosition(0);

    final AccessibilityEvent clone = AccessibilityEvent.CREATOR.createFromParcel(parcel);

    // Return the parcel to the global pool.
    parcel.recycle();

    return clone;
}