Example usage for android.os Bundle putParcelableArray

List of usage examples for android.os Bundle putParcelableArray

Introduction

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

Prototype

public void putParcelableArray(@Nullable String key, @Nullable Parcelable[] value) 

Source Link

Document

Inserts an array of Parcelable values into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:net.mm2d.dmsexplorer.CdsListActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putParcelableArray(KEY_HISTORY, mHistories.toArray(new History[mHistories.size()]));
    outState.putInt(KEY_POSITION, mCdsListAdapter.getSelection());
    if (mSelectedObject != null) {
        outState.putParcelable(KEY_SELECTED, mSelectedObject);
    }/*from  w w w.  jav a  2  s.  c  om*/
}

From source file:com.view.FragmentStatePagerAdapter.java

public Parcelable savaState() {
    Bundle state = null;
    if (mSavedState.size() > 0) {
        state = new Bundle();
        Fragment.SavedState[] fss = new Fragment.SavedState[mSavedState.size()];
        mSavedState.toArray(fss);/* ww  w.j a  va  2 s.  c  o  m*/
        state.putParcelableArray("states", fss);
    }
    for (int i = 0; i < mFragments.size(); i++) {
        Fragment f = mFragments.get(i);
        if (f != null) {
            if (state == null) {
                state = new Bundle();
            }
            String key = "f" + i;
            mFragmentManager.putFragment(state, key, f);
        }
    }
    return state;
}

From source file:de.spiritcroc.ownlog.ui.fragment.MultiSelectTagDialog.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putParcelableArray(KEY_LOG_ITEMS, mEditItems);
}

From source file:br.fapema.morholt.android.wizardpager.wizard.basic.FixedFragmentStatePagerAdapter.java

@Override
public Parcelable saveState() {
    Bundle state = null;
    if (mSavedState.size() > 0) {
        state = new Bundle();
        Fragment.SavedState[] fss = new Fragment.SavedState[mSavedState.size()];
        mSavedState.toArray(fss);/*from   w ww .  jav  a2s. co  m*/
        state.putParcelableArray("states", fss);
        state.putStringArrayList("tags", mSavedFragmentTags);
    }
    for (int i = 0; i < mFragments.size(); i++) {
        Fragment f = mFragments.get(i);
        if (f != null) {
            if (state == null) {
                state = new Bundle();
            }
            String key = "f" + i;
            mFragmentManager.putFragment(state, key, f);
        }
    }
    return state;
}

From source file:com.android.mail.utils.FragmentStatePagerAdapter2.java

@Override
public Parcelable saveState() {
    Bundle state = null;
    if (mEnableSavedStates && mSavedState.size() > 0) {
        state = new Bundle();
        Fragment.SavedState[] fss = new Fragment.SavedState[mSavedState.size()];
        mSavedState.toArray(fss);/*  w w w.  j ava 2  s .  c o m*/
        state.putParcelableArray("states", fss);
    }
    for (int i = 0; i < mFragments.size(); i++) {
        final int pos = mFragments.keyAt(i);
        final Fragment f = mFragments.valueAt(i);
        if (state == null) {
            state = new Bundle();
        }
        String key = "f" + pos;
        mFragmentManager.putFragment(state, key, f);
    }
    return state;
}

From source file:com.webalcove.travelbook.FixedFragmentStatePagerAdapter.java

@Override
public Parcelable saveState() {
    Bundle state = null;
    if (mSavedState.size() > 0) {
        state = new Bundle();
        Fragment.SavedState[] fss = new Fragment.SavedState[mSavedState.size()];
        mSavedState.toArray(fss);/* ww  w .j ava2s.  c  o m*/
        state.putParcelableArray("states", fss);
        //state.putStringArrayList("tags", mSavedFragmentTags);
    }
    for (int i = 0; i < mFragments.size(); i++) {
        Fragment f = mFragments.get(i);
        if (f != null) {
            if (state == null) {
                state = new Bundle();
            }
            String key = "f" + i;
            mFragmentManager.putFragment(state, key, f);
        }
    }
    return state;
}

From source file:am.project.x.widget.FragmentRemovePagerAdapter.java

@Override
public Parcelable saveState() {
    Bundle state = null;
    if (mSavedState.size() > 0) {
        state = new Bundle();
        Fragment.SavedState[] fss = new Fragment.SavedState[mSavedState.size()];
        mSavedState.toArray(fss);/*w w w .j  a v a  2 s. c  o m*/
        state.putParcelableArray("states", fss);
    }
    final int count = getCount();
    for (int position = 0; position < count; position++) {
        final long itemId = getItemId(position);
        String name = makeFragmentName(mViewGroupId, itemId);
        Fragment fragment = mFragmentManager.findFragmentByTag(name);
        if (fragment != null && fragment.isAdded()) {
            if (state == null) {
                state = new Bundle();
            }
            String key = "f" + itemId;
            mFragmentManager.putFragment(state, key, fragment);
        }
    }
    return state;
}

From source file:net.alexjf.tmm.activities.MoneyNodeDetailsActivity.java

private void updateData() {
    // If database not ready, do nothing
    if (!isDatabaseReady()) {
        return;/*from w ww  .  j a v a2  s  .c  om*/
    }

    // If no date interval set yet, skip. Initially, because of
    // onDatabaseReady, updateData might get called before the DateIntervalBarFragment
    // has had time to set the correct interval. No point getting data at this
    // point because we'll get it again once the interval is set correctly.
    if (!dateIntervalSet) {
        return;
    }

    // If task is already running, do nothing
    if (transactionTask != null) {
        return;
    }

    Utils.preventOrientationChanges(this);

    String strLoading = getResources().getString(R.string.loading);

    transactionTask = new AsyncTaskWithProgressDialog<Date>(this, TASK_TRANSACTIONS, strLoading) {
        @Override
        protected Bundle doInBackground(Date... args) {
            try {
                List<ImmediateTransaction> immediateTransactions = currentMoneyNode
                        .getImmediateTransactions(args[0], args[1]);
                Bundle bundle = new Bundle();
                bundle.putParcelableArray(KEY_IMMEDIATETRANSACTIONS,
                        immediateTransactions.toArray(new ImmediateTransaction[immediateTransactions.size()]));
                return bundle;
            } catch (DatabaseException e) {
                setThrowable(e);
                return null;
            }
        }

        ;
    };

    transactionTask.setResultListener(this);
    transactionTask.execute(startDate, endDate);
}

From source file:com.gawdl3y.android.tasktimer.adapters.NewFragmentStatePagerAdapter.java

@Override
public Parcelable saveState() {
    Bundle state = new Bundle();
    if (mItemIds.length > 0) {
        state.putIntArray("itemids", mItemIds);
    }/*  w  ww . j  a v  a 2 s.com*/
    if (mSavedState.size() > 0) {
        Fragment.SavedState[] fss = new Fragment.SavedState[mSavedState.size()];
        mSavedState.toArray(fss);
        state.putParcelableArray("states", fss);
    }
    for (int i = 0; i < mFragments.size(); i++) {
        Fragment f = mFragments.get(i);
        if (f != null) {
            String key = "f" + i;
            mFragmentManager.putFragment(state, key, f);
        }
    }
    return state;
}

From source file:org.openintents.safe.SearchFragment.java

/**
 * If we have results, save them for use with onActivityCreated()
 */// w  ww  .jav  a 2  s . c o  m
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if (results != null) {
        SearchEntry[] aResults = new SearchEntry[results.size()];
        results.toArray(aResults);
        outState.putParcelableArray(KEY_RESULTS, aResults);
    }
}