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:org.solovyev.android.checkout.PurchasesTest.java

@Test
public void testShouldReadEmptyList() throws Exception {
    final Bundle bundle = new Bundle();
    bundle.putStringArrayList(Purchases.BUNDLE_DATA_LIST, new ArrayList<String>());
    final Purchases purchases = Purchases.fromBundle(bundle, "test");
    assertTrue(purchases.list.isEmpty());
}

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

@Nonnull
private Bundle prepareBundle() throws JSONException {
    final ArrayList<String> list = new ArrayList<String>();
    list.add(PurchaseTest.newJson(1, Purchase.State.REFUNDED));
    list.add(PurchaseTest.newJson(2, Purchase.State.CANCELLED));
    list.add(PurchaseTest.newJson(3, PURCHASED));
    final Bundle bundle = new Bundle();
    bundle.putStringArrayList(Purchases.BUNDLE_DATA_LIST, list);
    return bundle;
}

From source file:com.secbro.qark.exportedcomponent.exportedreceiver.IntentSenderActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_intent_sender);

    intentKeys = new ArrayList<String>();

    if (getIntent() != null) {
        exportedReceiverId = getIntent().getStringExtra(ExportedReceiverListFragment.EXPORTED_RECEIVER_ID);
        exportedReceiverName = getIntent().getStringExtra(ExportedReceiverListFragment.EXPORTED_RECEIVER_NAME);

        if (getResources().getIdentifier(exportedReceiverId, "array", this.getPackageName()) != 0) {
            intentKeys.addAll(Arrays.asList(getResources().getStringArray(
                    getResources().getIdentifier(exportedReceiverId, "array", this.getPackageName()))));
        }// ww  w  . j  av a2  s .  c om
    }

    if (!intentKeys.isEmpty()) {
        Bundle keys = new Bundle();
        keys.putString(ExportedReceiverListFragment.EXPORTED_RECEIVER_NAME, exportedReceiverName);
        keys.putString(ExportedReceiverListFragment.EXPORTED_RECEIVER_ID, exportedReceiverId);
        keys.putStringArrayList(INTENT_KEYS, intentKeys);

        IntentSenderFragment intentSenderFragment = new IntentSenderFragment();
        intentSenderFragment.setArguments(keys);

        if (savedInstanceState == null) {
            getSupportFragmentManager().beginTransaction().add(R.id.container, intentSenderFragment).commit();
        }
    } else {
        Log.d("INFO", "Exported receiver needs no params");
        Intent intent = new Intent();
        intent.setAction(exportedReceiverName);
        sendBroadcast(intent);
        Toast.makeText(this, "Intent sent", Toast.LENGTH_LONG).show();
    }
}

From source file:com.tencent.wstt.gt.activity.GTParamInFragment.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    String key = IpUIManager.list_ip.get(position).getKey();
    if (key.equals(ParamConst.DIVID_TITLE) || key.equals(ParamConst.PROMPT_INIT_TITLE)
            || key.equals(ParamConst.PROMPT_TITLE) || key.equals(ParamConst.PROMPT_DISABLE_TITLE)) {
        return;/*from w  w w. j  a  v  a2 s . c o m*/
    }
    if (position > IpUIManager.getInListDisableTitlePosition()) {
        return;
    }
    InPara ip = IpUIManager.list_ip.get(position);
    Bundle bundle = new Bundle();
    bundle.putString("ip_name", key);
    bundle.putString("ip_client", ip.getClient());
    bundle.putStringArrayList("ip_values", (ArrayList<String>) ip.getValues());

    Intent intent = new Intent(getActivity(), GTInputParamSetActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.putExtras(bundle);
    startActivity(intent);
}

From source file:ivl.android.moneybalance.CalculationEditorActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putStringArrayList("personNames", getPersonNames());
}

From source file:com.krayzk9s.imgurholo.ui.AlbumsFragment.java

@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
    savedInstanceState.putStringArrayList("urls", urls);
    savedInstanceState.putStringArrayList("ids", ids);
    // Always call the superclass so it can save the view hierarchy state
    super.onSaveInstanceState(savedInstanceState);
}

From source file:com.amaze.filemanager.fragments.BookmarksManager.java

@Override
public void onSaveInstanceState(Bundle b) {
    super.onSaveInstanceState(b);
    if (listview != null) {
        b.putStringArrayList("bx", utils.toStringArray(bx));
        int index = linearLayoutManager.findFirstVisibleItemPosition();
        View vi = listview.getChildAt(0);
        int top = (vi == null) ? 0 : vi.getTop();
        b.putInt("index", index);
        b.putInt("top", top);
    }//from  w w  w  . j a va 2s.c o  m
}

From source file:com.nextgis.maplibui.util.TrackView.java

@Override
public Parcelable onSaveInstanceState() {
    Bundle bundle = new Bundle();
    bundle.putParcelable("instanceState", super.onSaveInstanceState());
    bundle.putStringArrayList(BUNDLE_SELECTED_ITEMS_ID, mSelectedIds);
    return bundle;
}

From source file:io.teak.sdk.GooglePlay.java

private JSONObject querySkuDetails(String itemType, String sku) {
    try {//w  w w . j  a  v a  2  s  .  c o  m
        ArrayList<String> skuList = new ArrayList<>();
        skuList.add(sku);
        Class<?> cls = Class.forName("com.android.vending.billing.IInAppBillingService");
        Method m = cls.getMethod("getSkuDetails", int.class, String.class, String.class, Bundle.class);

        Bundle querySkus = new Bundle();
        querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);

        Bundle skuDetails = (Bundle) m.invoke(mService, 3, mContext.getPackageName(), itemType, querySkus);

        if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
            int response = getResponseCodeFromBundle(skuDetails);
            if (response != BILLING_RESPONSE_RESULT_OK) {
                Log.e(LOG_TAG, "getSkuDetails() failed: " + response);
                return null;
            } else {
                Log.e(LOG_TAG, "getSkuDetails() returned a bundle with neither an error nor a detail list.");
                return null;
            }
        }

        ArrayList<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST);

        if (responseList != null && responseList.size() == 1) {
            JSONObject ret = new JSONObject(responseList.get(0));
            if (Teak.isDebug) {
                Log.d(LOG_TAG, "SKU Details: " + ret.toString(2));
            }
            return ret;
        } else {
            Log.e(LOG_TAG, "Mismatched input/output length for getSkuDetails().");
        }
    } catch (Exception e) {
        Log.e(LOG_TAG, "Reflection error: " + Log.getStackTraceString(e));
        Teak.sdkRaven.reportException(e);
    }

    return null;
}

From source file:com.nearalias.musicplayer.MainActivity.java

private void selectItem(int position) {
    // update the main content by replacing fragments
    if (getFragmentManager().findFragmentById(R.id.content_frame) == null) {
        Fragment fragment = new PlayListFragment();
        Bundle args = new Bundle();
        args.putInt(PlayListFragment.ARG_PLANET_NUMBER, position);
        makeUpFakeSongs();//w  ww  .  j  a  v a2  s .  c  o m
        args.putStringArrayList(PlayListFragment.ARG_SONG_NAME, names);
        args.putStringArrayList(PlayListFragment.ARG_SONG_ARTIST, artists);
        args.putStringArrayList(PlayListFragment.ARG_SONG_ALBUM, albums);
        args.putStringArrayList(PlayListFragment.ARG_SONG_GENRE, genres);
        args.putStringArrayList(PlayListFragment.ARG_SONG_LYRIC, lyrics);
        fragment.setArguments(args);

        FragmentManager fragmentManager = getFragmentManager();
        fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();
    }
    // update selected item and title, then close the drawer
    drawerListView.setItemChecked(position, true);
    setTitle(planetTitles[position]);
    drawerLayout.closeDrawer(drawerListView);
}