Example usage for android.os Bundle deepCopy

List of usage examples for android.os Bundle deepCopy

Introduction

In this page you can find the example usage for android.os Bundle deepCopy.

Prototype

public Bundle deepCopy() 

Source Link

Document

Make a deep copy of the given bundle.

Usage

From source file:android.support.content.ContentPager.java

/**
 * @return Bundle populated with existing extras (if any) as well as
 * all usefule paging related extras./*from ww  w . j  ava  2 s .  c  om*/
 */
static Bundle buildExtras(@Nullable Bundle extras, int recordCount, @CursorDisposition int cursorDisposition) {

    if (extras == null || extras == Bundle.EMPTY) {
        extras = new Bundle();
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        extras = extras.deepCopy();
    }
    // else we modify cursor extras directly, cuz that's our only choice.

    extras.putInt(CURSOR_DISPOSITION, cursorDisposition);
    if (!extras.containsKey(EXTRA_TOTAL_COUNT)) {
        extras.putInt(EXTRA_TOTAL_COUNT, recordCount);
    }

    if (!extras.containsKey(EXTRA_HONORED_ARGS)) {
        extras.putStringArray(EXTRA_HONORED_ARGS,
                new String[] { ContentPager.QUERY_ARG_OFFSET, ContentPager.QUERY_ARG_LIMIT });
    }

    return extras;
}