Example usage for android.os Bundle putStringArrayList

List of usage examples for android.os Bundle putStringArrayList

Introduction

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

Prototype

@Override
public void putStringArrayList(@Nullable String key, @Nullable ArrayList<String> value) 

Source Link

Document

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

Usage

From source file:com.luorrak.ouroboros.reply.ReplyCommentFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putStringArrayList("filePath", reply.filePath);
}

From source file:com.envyserve.githubreference.billing.BillingProcessor.java

private List<SkuDetails> getSkuDetails(ArrayList<String> productIdList, String purchaseType) {
    if (billingService != null && productIdList != null && productIdList.size() > 0) {
        try {//  ww  w .  j  a  v  a 2  s  .c  om
            Bundle products = new Bundle();
            products.putStringArrayList(Constants.PRODUCTS_LIST, productIdList);
            Bundle skuDetails = billingService.getSkuDetails(Constants.GOOGLE_API_VERSION, contextPackageName,
                    purchaseType, products);
            int response = skuDetails.getInt(Constants.RESPONSE_CODE);

            if (response == Constants.BILLING_RESPONSE_RESULT_OK) {
                ArrayList<SkuDetails> productDetails = new ArrayList<SkuDetails>();

                for (String responseLine : skuDetails.getStringArrayList(Constants.DETAILS_LIST)) {
                    JSONObject object = new JSONObject(responseLine);
                    SkuDetails product = new SkuDetails(object);
                    productDetails.add(product);
                }
                return productDetails;

            } else {
                if (eventHandler != null)
                    eventHandler.onBillingError(response, null);
                Log.e(LOG_TAG, String.format("Failed to retrieve info for %d products, %d",
                        productIdList.size(), response));
            }
        } catch (Exception e) {
            Log.e(LOG_TAG, String.format("Failed to call getSkuDetails %s", e.toString()));
        }
    }
    return null;
}

From source file:com.pixplicity.castdemo.MainActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putStringArrayList("usernames", mMessageListUsernames);
    outState.putStringArrayList("messages", mMessageListMessages);
}

From source file:com.liferay.mobile.screens.base.list.BaseListScreenletView.java

@Override
protected Parcelable onSaveInstanceState() {
    Parcelable superState = super.onSaveInstanceState();

    A adapter = getAdapter();/*from www  .  j  a  va2s.c o m*/
    ArrayList<E> entries = (ArrayList<E>) adapter.getEntries();

    Bundle state = new Bundle();
    state.putParcelableArrayList(STATE_ENTRIES, entries);
    state.putSerializable(STATE_ROW_COUNT, adapter.getItemCount());
    state.putParcelable(STATE_SUPER, superState);
    state.putStringArrayList(STATE_LABEL_FIELDS,
            (ArrayList<String>) ((BaseListScreenlet) getScreenlet()).getLabelFields());
    state.putInt(STATE_FIRST_ROW, firstRow);

    return state;
}

From source file:com.arcusapp.soundbox.fragment.PlayFragment.java

@Override
public void onClick(View v) {
    if (currentSong == null || mediaService == null) {
        return;/* w  ww .  j  a  v a  2 s  .c  o m*/
    }

    if (v.getId() == R.id.btnPlayPause) {
        mediaService.playAndPause();
    } else if (v.getId() == R.id.btnPanel) {
        if (mIsPanelExpanded) {
            Intent intent = new Intent();
            intent.setAction(SoundBoxApplication.ACTION_SONGSLIST_ACTIVITY);

            Bundle mExtras = new Bundle();
            List<String> songsID = mediaService.getSongsIDList();
            mExtras.putStringArrayList(BundleExtra.SONGS_ID_LIST, (ArrayList<String>) songsID);
            String currentSongID = mediaService.getCurrentSong().getID();
            mExtras.putString(BundleExtra.CURRENT_ID, currentSongID);

            intent.putExtras(mExtras);
            startActivity(intent);
        } else {
            mediaService.playAndPause();
        }
    } else if (v.getId() == R.id.btnPrevSong) {
        mediaService.playPreviousSong();

    } else if (v.getId() == R.id.btnNextSong) {
        mediaService.playNextSong();
    } else if (v.getId() == R.id.btnSwitchRandom) {
        mediaService.changeRandomState();
        //Toast.makeText(this, randomStateToText(mediaService.getRandomState()), Toast.LENGTH_SHORT).show();
    } else if (v.getId() == R.id.btnSwitchRepeat) {
        mediaService.changeRepeatState();
        //Toast.makeText(this, repeatStateToText(mediaService.getRepeatState()), Toast.LENGTH_SHORT).show();
    }
}

From source file:net.networksaremadeofstring.rhybudd.ViewZenossDeviceListActivity.java

@Override
public void onItemSelected(ZenossDevice device, ArrayList<String> DeviceNames, ArrayList<String> DeviceIDs) {
    selectedUID = device.getuid();// w  ww.j  a  v a 2 s  .c  o m
    selectedDevice = device.getname();
    //Log.e("selectedUID", selectedUID);
    if (mTwoPane) {
        // In two-pane mode, show the detail view in this activity by
        // adding or replacing the detail fragment using a
        // fragment transaction.
        Bundle arguments = new Bundle();
        arguments.putString(ViewZenossDeviceFragment.ARG_HOSTNAME, selectedDevice);
        arguments.putString(ViewZenossDeviceFragment.ARG_UID, selectedUID);
        arguments.putBoolean(ViewZenossDeviceFragment.ARG_2PANE, true);
        arguments.putStringArrayList(ViewZenossDeviceFragment.ARG_DEVICENAMES, DeviceNames);
        arguments.putStringArrayList(ViewZenossDeviceFragment.ARG_DEVICEIDS, DeviceIDs);

        ViewZenossDeviceFragment fragment = new ViewZenossDeviceFragment();
        fragment.setArguments(arguments);
        getSupportFragmentManager().beginTransaction().replace(R.id.device_detail_container, fragment).commit();
        ab.setSubtitle("Viewing " + selectedDevice);

    } else {
        // In single-pane mode, simply start the detail activity
        // for the selected item ID.
        Intent detailIntent = new Intent(this, ViewZenossDeviceActivity.class);
        detailIntent.putExtra(ViewZenossDeviceFragment.ARG_HOSTNAME, selectedDevice);
        detailIntent.putExtra(ViewZenossDeviceFragment.ARG_UID, selectedUID);
        detailIntent.putExtra(ViewZenossDeviceFragment.ARG_2PANE, false);
        detailIntent.putStringArrayListExtra(ViewZenossDeviceFragment.ARG_DEVICENAMES, DeviceNames);
        detailIntent.putStringArrayListExtra(ViewZenossDeviceFragment.ARG_DEVICEIDS, DeviceIDs);
        startActivityForResult(detailIntent, LAUNCHDETAILACTIVITY);
    }
}

From source file:me.henrytao.bootstrapandroidlibrarydemo.activity.BaseActivity.java

private void requestItemsForPurchase(final AsyncCallback<List<PurchaseItem>> callback) {
    if (mPurchaseItems != null && mPurchaseItems.size() > 0) {
        if (callback != null) {
            callback.onSuccess(mPurchaseItems);
        }/*from ww  w . j ava 2  s.c  o  m*/
        return;
    }
    new AsyncTask<IInAppBillingService, Void, AsyncResult<List<PurchaseItem>>>() {

        @Override
        protected AsyncResult<List<PurchaseItem>> doInBackground(IInAppBillingService... params) {
            List<PurchaseItem> result = new ArrayList<>();
            Throwable exception = null;
            IInAppBillingService billingService = params[0];

            if (billingService == null) {
                exception = new Exception("Unknow");
            } else {
                ArrayList<String> skuList = new ArrayList<>(Arrays.asList(mDonateItems));
                Bundle querySkus = new Bundle();
                querySkus.putStringArrayList("ITEM_ID_LIST", skuList);
                try {
                    Bundle skuDetails = billingService.getSkuDetails(3, getPackageName(), "inapp", querySkus);
                    int response = skuDetails.getInt("RESPONSE_CODE");
                    if (response == 0) {
                        ArrayList<String> responseList = skuDetails.getStringArrayList("DETAILS_LIST");
                        PurchaseItem purchaseItem;
                        for (String item : responseList) {
                            purchaseItem = new PurchaseItem(new JSONObject(item));
                            if (purchaseItem.isValid()) {
                                result.add(purchaseItem);
                            }
                        }
                    }
                } catch (RemoteException e) {
                    e.printStackTrace();
                    exception = e;
                } catch (JSONException e) {
                    e.printStackTrace();
                    exception = e;
                }
            }
            return new AsyncResult<>(result, exception);
        }

        @Override
        protected void onPostExecute(AsyncResult<List<PurchaseItem>> result) {
            if (!isFinishing() && callback != null) {
                Throwable error = result.getError();
                if (error == null && (result.getResult() == null || result.getResult().size() == 0)) {
                    error = new Exception("Unknow");
                }
                if (error != null) {
                    callback.onError(error);
                } else {
                    mPurchaseItems = result.getResult();
                    Collections.sort(mPurchaseItems, new Comparator<PurchaseItem>() {
                        @Override
                        public int compare(PurchaseItem lhs, PurchaseItem rhs) {
                            return (int) ((lhs.getPriceAmountMicros() - rhs.getPriceAmountMicros()) / 1000);
                        }
                    });
                    callback.onSuccess(mPurchaseItems);
                }
            }
        }
    }.execute(mBillingService);
}

From source file:org.solovyev.android.checkout.PurchasesTest.java

@Test
public void testShouldReadListWithSignatures() throws Exception {
    final Bundle bundle = prepareBundle();
    final ArrayList<String> signatures = new ArrayList<String>();
    signatures.add("sig_1");
    signatures.add("sig_2");
    signatures.add("sig_3");
    bundle.putStringArrayList(Purchases.BUNDLE_SIGNATURE_LIST, signatures);

    final Purchases purchases = Purchases.fromBundle(bundle, "test");

    assertEquals(3, purchases.list.size());
    assertEquals("sig_1", purchases.list.get(0).signature);
    assertEquals("sig_2", purchases.list.get(1).signature);
    assertEquals("sig_3", purchases.list.get(2).signature);
}

From source file:com.money.manager.ex.investment.watchlist.WatchlistItemsFragment.java

private Bundle prepareArgsForChildFragment() {
    ArrayList<String> selection = new ArrayList<>();

    if (this.accountId != Constants.NOT_SET) {
        selection.add(StockFields.HELDAT + "=" + Integer.toString(this.accountId));
    }//  w w  w  .j  a va 2 s.  co  m

    Bundle args = new Bundle();
    args.putStringArrayList(AllDataListFragment.KEY_ARGUMENTS_WHERE, selection);
    args.putString(AllDataListFragment.KEY_ARGUMENTS_SORT, StockFields.SYMBOL + " ASC");

    return args;
}

From source file:net.named_data.nfd.PingClientFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putBoolean(TAG_PING_STATUS, m_isStartState);
    outState.putString(TAG_PING_NAME, m_pingNameEditText.getText().toString());
    outState.putStringArrayList(TAG_PING_DATA, m_pingResultListAdapter.m_data);
    if (!m_isStartState && m_client != null) {
        outState.putSerializable(TAG_PING_STATE, m_client.getState());
    }/*from  w  ww  . j  a  v  a  2s.co m*/
}