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:li.barter.fragments.SelectPreferredLocationFragment.java

@Override
public void onSaveInstanceState(final Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putParcelableArray(Keys.LOCATIONS, mVenues);
    outState.putBoolean(Keys.OVERLAY_VISIBLE, mIsOverlayShown);
}

From source file:com.microsoft.rightsmanagement.ui.PolicyPickerActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    Logger.ms(TAG, "onSaveInstanceState");
    super.onSaveInstanceState(outState);
    outState.putInt(REQUEST_CALLBACK_ID, mRequestCallbackId);
    outState.putParcelableArray(REQUEST_TEMPLATE_DESCRIPTOR_ITEM_ARRAY, mTemplateDescriptorItemArray);
    outState.putParcelable(REQUEST_ORIGINAL_TEMPLATE_DESCRIPTOR_ITEM, mOriginalTemplateDescriptorItem);
    outState.putInt(CURRENT_SELECTED_TEMPLATE_DESCRIPTOR_INDEX, mCurrentSelectedtemplateDescriptorItemIndex);
    Logger.me(TAG, "onSaveInstanceState");
}

From source file:com.example.newfragmentstatepageradapter.NewFragmentStatePagerAdapter.java

@Override
public Parcelable saveState() {
    Bundle state = new Bundle();
    if (mItemIds.length > 0) {
        state.putLongArray("itemids", mItemIds);
    }/*from w w w.  j  av  a 2  s. co m*/
    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:com.vincestyling.traversaless.FragmentStatePagerAdapter.java

@Override
public Parcelable saveState() {
    Bundle state = null;
    if (mSavedState.size() > 0) {
        state = new Bundle();
        Fragment.SavedState[] fss = new Fragment.SavedState[mSavedState.size()];
        for (int i = 0; i < mSavedState.size(); i++) {
            SavedStateInfo fsi = mSavedState.get(i);
            fss[i] = fsi != null ? fsi.state : null;
        }/*from w  w w. j a va2 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:nz.ac.otago.psyanlab.common.designer.EditorSectionManager.java

public Parcelable saveState() {
    Bundle state = null;

    saveCurrentFragmentState();//www.ja v  a2 s  .c  o  m
    if (mSavedState.size() > 0) {
        state = new Bundle();
        Fragment.SavedState[] fss = new Fragment.SavedState[mSavedState.size()];
        int[] keys = new int[mSavedState.size()];
        for (int i = 0; i < mSavedState.size(); i++) {
            int key = mSavedState.keyAt(i);
            keys[i] = key;
            fss[i] = mSavedState.get(key);
        }
        state.putParcelableArray("states", fss);
        state.putIntArray("state_keys", keys);
    }

    state.putInt("current_position", mCurrentPosition);

    return state;
}

From source file:org.deviceconnect.android.deviceplugin.host.activity.TouchProfileActivity.java

/**
 * Send event data.//from   www  .j  a  va2s. com
 *
 * @param state MotionEvent state.
 * @param event MotionEvent.
 * @param events Event request list.
 */
private void sendEventData(final String state, final MotionEvent event, final List<Event> events) {
    List<Event> touchEvents = EventManager.INSTANCE.getEventList(mServiceId, TouchProfile.PROFILE_NAME, null,
            ATTRIBUTE_ON_TOUCH_CHANGE);
    Bundle touchdata = new Bundle();
    List<Bundle> touchlist = new ArrayList<Bundle>();
    Bundle touches = new Bundle();
    for (int n = 0; n < event.getPointerCount(); n++) {
        int pointerId = event.getPointerId(n);
        touchdata.putInt(TouchProfile.PARAM_ID, pointerId);
        touchdata.putFloat(TouchProfile.PARAM_X, event.getX(n));
        touchdata.putFloat(TouchProfile.PARAM_Y, event.getY(n));
        touchlist.add((Bundle) touchdata.clone());
    }
    touches.putParcelableArray(TouchProfile.PARAM_TOUCHES, touchlist.toArray(new Bundle[touchlist.size()]));
    for (int i = 0; i < events.size(); i++) {
        Event eventdata = events.get(i);
        String attr = eventdata.getAttribute();
        Intent intent = EventManager.createEventMessage(eventdata);
        intent.putExtra(TouchProfile.PARAM_TOUCH, touches);
        intent.setAction(HostTouchProfile.ACTION_TOUCH);
        LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
        mApp.setTouchCache(attr, touches);
    }
    for (int i = 0; i < touchEvents.size(); i++) {
        Event eventdata = touchEvents.get(i);
        String attr = eventdata.getAttribute();
        touches.putString("state", state);
        Intent intent = EventManager.createEventMessage(eventdata);
        intent.putExtra(TouchProfile.PARAM_TOUCH, touches);
        intent.setAction(HostTouchProfile.ACTION_TOUCH);
        LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
        mApp.setTouchCache(attr, touches);
    }

}

From source file:com.github.paradam.infinitepager.InfiniteFragmentStatePagerAdapter.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 w  w. j  a  va 2  s  .  com*/
        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);
        }
    }
    if (state != null) {
        state.putInt("currentPrimaryItem", mFragments.indexOf(mCurrentPrimaryItem));
    }
    return state;
}

From source file:com.github.paradam.support.v4.infinitepager.InfiniteFragmentStatePagerAdapter.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 w  w.  ja  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 && f.isAdded()) {
            if (state == null) {
                state = new Bundle();
            }
            String key = "f" + i;
            mFragmentManager.putFragment(state, key, f);
        }
    }
    if (state != null) {
        state.putInt("currentPrimaryItem", mFragments.indexOf(mCurrentPrimaryItem));
    }

    return state;
}

From source file:com.example.suspectedBug.myapplication.IapSampleActivity.java

/**
 * Save the products and receipts if we're going for a restart
 */// w w  w.j a  v a 2 s  .c  om

@Override
protected void onSaveInstanceState(final Bundle outState) {
    if (mProductList != null) {
        outState.putParcelableArray(PRODUCTS_INSTANCE_STATE_KEY,
                mProductList.toArray(new Product[mProductList.size()]));
    }
    if (mReceiptList != null) {
        outState.putParcelableArray(RECEIPTS_INSTANCE_STATE_KEY,
                mReceiptList.toArray(new Receipt[mReceiptList.size()]));
    }
}

From source file:at.jclehner.rxdroid.ui.ScheduleGridFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    //final Fraction[][] doses = new Fraction[mHolders.length][4];

    for (int i = 0; i != mHolders.length; ++i) {
        final Fraction[] doses = new Fraction[Schedule.DOSE_TIME_COUNT];

        for (int j = 0; j != Schedule.DOSE_TIME_COUNT; ++j)
            doses[j] = mHolders[i].doseViews[j].getDose();

        outState.putParcelableArray("doses_" + i, doses);
    }/* w  w w  . j  a v  a2 s  .c o  m*/

    outState.putLong("day_status", mDayStatus.longValue());
}