Example usage for android.app Fragment setIndex

List of usage examples for android.app Fragment setIndex

Introduction

In this page you can find the example usage for android.app Fragment setIndex.

Prototype

final void setIndex(int index, Fragment parent) 

Source Link

Usage

From source file:android.app.FragmentManager.java

void makeActive(Fragment f) {
    if (f.mIndex >= 0) {
        return;/*from  ww w.j  a v a 2s. c  o  m*/
    }

    if (mAvailIndices == null || mAvailIndices.size() <= 0) {
        if (mActive == null) {
            mActive = new ArrayList<Fragment>();
        }
        f.setIndex(mActive.size(), mParent);
        mActive.add(f);

    } else {
        f.setIndex(mAvailIndices.remove(mAvailIndices.size() - 1), mParent);
        mActive.set(f.mIndex, f);
    }
    if (DEBUG)
        Log.v(TAG, "Allocated fragment index " + f);
}