Example usage for android.os Bundle putIntArray

List of usage examples for android.os Bundle putIntArray

Introduction

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

Prototype

public void putIntArray(@Nullable String key, @Nullable int[] value) 

Source Link

Document

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

Usage

From source file:org.harleydroid.HarleyDroidService.java

public void setSendData(String type[], String ta[], String sa[], String command[], String expect[],
        int timeout[], int delay) {
    if (D)//  ww  w  .j a v  a2 s.  c om
        Log.d(TAG, "setSendData()");
    Message m = mServiceHandler.obtainMessage(MSG_SET_SEND);
    Bundle b = new Bundle();
    b.putStringArray("type", type);
    b.putStringArray("ta", ta);
    b.putStringArray("sa", sa);
    b.putStringArray("command", command);
    b.putStringArray("expect", expect);
    b.putIntArray("timeout", timeout);
    b.putInt("delay", delay);
    m.setData(b);
    //mServiceHandler.removeCallbacksAndMessages(null);
    m.sendToTarget();
}

From source file:com.pseudosudostudios.jdd.activities.GameActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    if (bg.tiles == null || bg.tiles[2][2] == null || bg == null) {
        super.onSaveInstanceState(outState);
        return;// ww w  .  j av  a  2s . co m
    }
    for (int r = 0; r < bg.tiles.length; r++)
        for (int c = 0; c < bg.tiles[r].length; c++) {
            outState.putIntArray(onSaveBaseString + r + c, bg.tiles[r][c].toIntArray());
            if (bg.sol1 != null && bg.sol1[r][c] != null)
                outState.putIntArray(onSaveSolution + r + c, bg.sol1[r][c].toIntArray());
        }
    try {
        outState.putIntArray(onSaveCeterTile, bg.getCenterTile().toIntArray());
    } catch (NullPointerException e) {
        outState.putIntArray(onSaveCeterTile, bg.tiles[1][1].toIntArray());
    }
    outState.putInt(bundleGameColors, Grid.numberOfColors);
    outState.putInt(jsonTileSize, Grid.tileSize);
    outState.putString(onSaveBaseString, bg.getDifficulty().toString());
    outState.putInt(bundleGameColors, Grid.numberOfColors);
    outState.putLong(onSaveTime, bg.getTimeSinceStart());
}

From source file:com.owncloud.android.ui.fragment.contactsbackup.ContactListFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putIntArray(CHECKED_ITEMS_ARRAY_KEY, contactListAdapter.getCheckedIntArray());
}

From source file:com.money.manager.ex.reports.IncomeVsExpensesListFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    ArrayList<Integer> years = new ArrayList<Integer>();
    for (int i = 0; i < mYearsSelected.size(); i++) {
        if (mYearsSelected.get(mYearsSelected.keyAt(i))) {
            years.add(mYearsSelected.keyAt(i));
        }/*from  w ww .j  av a2  s. com*/
    }
    outState.putIntArray(KEY_BUNDLE_YEAR, ArrayUtils.toPrimitive(years.toArray(new Integer[0])));
}

From source file:org.gnucash.android.ui.transactions.TransactionsListFragment.java

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

    int[] selectedPositions = new int[mSelectedIds.size()];
    int i = 0;//w ww.  j  a  va 2s . c om
    for (Integer id : mSelectedIds.keySet()) {
        if (id == null)
            continue;
        selectedPositions[i++] = id;
    }
    outState.putIntArray(SAVED_SELECTED_ITEMS, selectedPositions);
}

From source file:com.example.android.snake.SnakeView.java

/**
 * Save game state so that the user does not lose anything
 * if the game process is killed while we are in the
 * background./*from w w w.  j  a  v  a 2s .c  o m*/
 *
 * @return a Bundle with this view's state
 */
public Bundle saveState() {
    Bundle map = new Bundle();

    map.putIntArray("mAppleList", coordArrayListToArray(mAppleList));
    map.putInt("mDirection", Integer.valueOf(mDirection));
    map.putInt("mNextDirection", Integer.valueOf(mNextDirection));
    map.putLong("mMoveDelay", Long.valueOf(mMoveDelay));
    map.putLong("mScore", Long.valueOf(mScore));
    map.putIntArray("mSnakeTrail", coordArrayListToArray(mSnakeTrail));

    return map;
}

From source file:org.ale.scanner.zotero.MainActivity.java

@Override
public void onSaveInstanceState(Bundle state) {
    super.onSaveInstanceState(state);
    state.putStringArrayList(RC_PEND, mPendingItems);
    state.putIntegerArrayList(RC_PEND_STAT, mPendingStatus);
    state.putIntArray(RC_CHECKED, mItemAdapter.getChecked());
    state.putParcelable(RC_ACCESS, mAccountAccess);
    state.putInt(RC_UPLOADING, mUploadState);
    state.putSparseParcelableArray(RC_GROUPS, mGroups);
}

From source file:com.medicohealthcare.service.ChatServer.java

/**
 * In an IntentService, onHandleIntent is run on a background thread.  As it
 * runs, it broadcasts its current status using the LocalBroadcastManager.
 * @param workIntent The Intent that starts the IntentService. This Intent contains the
 * URL of the web site from which the RSS parser gets data.
 *///ww  w.j  av a 2s.co m
@Override
protected void onHandleIntent(Intent workIntent) {
    Cursor cursor = null;

    /*
     * A block that tries to connect to the Picasa featured picture URL passed as the "data"
     * value in the incoming Intent. The block throws exceptions (see the end of the block).
     */
    // If the connection is an HTTP connection, continue
    if (api != null) {

        // Broadcasts an Intent indicating that processing has started.
        //                mBroadcaster.broadcastIntentWithState(Constants.STATE_ACTION_STARTED);

        /*
         * Queries the content provider to see if this URL was read previously, and when.
         * The content provider throws an exception if the URI is invalid.
         */
        Bundle bundle = workIntent.getExtras();
        int profileId = bundle.getInt(PARAM.PROFILE_ID);

        api.getNewMessageCountsByRecipient(new MessageRequest(profileId),
                new Callback<List<ChatMessageCounts>>() {
                    @Override
                    public void success(List<ChatMessageCounts> messagecount, Response response) {
                        int[] ids = new int[messagecount.size()];
                        int[] numberOfMessages = new int[messagecount.size()];
                        for (int i = 0; i < ids.length; i++) {
                            ids[i] = messagecount.get(i).senderId;
                            numberOfMessages[i] = messagecount.get(i).noOfNewMessages;
                        }
                        Intent localIntent = new Intent(Constants.NEW_MESSAGE_ARRIVED);
                        Bundle bundle = new Bundle();
                        bundle.putIntArray(Constants.NEW_MESSAGE_IDS, ids);
                        bundle.putIntArray(Constants.NEW_MESSAGE_NUMBERS, numberOfMessages);
                        localIntent.putExtras(bundle);
                        localIntent.setAction(Constants.NEW_MESSAGE_ARRIVED);
                        LocalBroadcastManager.getInstance(HomeActivity.getParentAtivity())
                                .sendBroadcast(localIntent);
                    }

                    @Override
                    public void failure(RetrofitError error) {
                        //                        error.printStackTrace();
                    }
                });

        // Reports that the feed retrieval is complete.
        //                mBroadcaster.broadcastIntentWithState(Constants.STATE_ACTION_COMPLETE);
    }
}

From source file:com.frostwire.android.gui.activities.MainActivity.java

private void saveFragmentsStack(Bundle outState) {
    int[] stack = new int[fragmentsStack.size()];
    for (int i = 0; i < stack.length; i++) {
        stack[i] = fragmentsStack.get(i);
    }/*from  w w w  . j a  v a 2s. co  m*/
    outState.putIntArray(FRAGMENTS_STACK_KEY, stack);
}

From source file:com.sanbo.fragment.base.AppMainTabActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if (Config.DEBUG)
        Toast.makeText(this, getResources().getString(R.string.action_home_show), Toast.LENGTH_LONG).show();
    outState.putString("myFrag", mCurrentTab);
    outState.putInt("numInList", mStacks.get(mCurrentTab).size());
    outState.putInt("tabSelected", mTabHost.getCurrentTab());
    Iterator<Integer> iter = mCurSel.get(mCurrentTab).iterator();
    int i = 0;/* w  w w. j av  a2  s. c  o  m*/
    int[] val = new int[mCurSel.get(mCurrentTab).size()];
    // saving selections to arrive to the fragment
    while (iter.hasNext()) {
        val[i] = iter.next();
    }
    outState.putIntArray("valPass", val);

}