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.kaliturin.blacklist.fragments.AddOrEditContactFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    // save numbers and types to the lists
    ArrayList<String> numbers = new ArrayList<>();
    ArrayList<Integer> types = new ArrayList<>();
    Set<Pair<String, Integer>> numbers2TypeSet = getNumber2TypePairs();
    for (Pair<String, Integer> pair : numbers2TypeSet) {
        numbers.add(pair.first);/* w ww. j av  a  2  s. c  o  m*/
        types.add(pair.second);
    }

    // save lists to state
    outState.putStringArrayList(CONTACT_NUMBERS, numbers);
    outState.putIntegerArrayList(CONTACT_NUMBER_TYPES, types);
}

From source file:com.equalsd.recon.UserActivity.java

protected void querySubmit() {
    AsyncHttpClient client = new AsyncHttpClient();

    JSONObject jsonParams = new JSONObject();
    final String[] status = new String[1];
    try {/*from  ww w  .j  av  a2s.c om*/
        jsonParams.put("username", login_name.getText().toString());
        jsonParams.put("password", password.getText().toString());
        jsonParams.put("email", email.getText().toString());
        jsonParams.put("contact_name", user_name.getText().toString());
        jsonParams.put("contact_phone", phone.getText().toString());
        jsonParams.put("company_address", company_address.getText().toString());
        jsonParams.put("company_name", company_name.getText().toString());
        jsonParams.put("question", question.getText().toString());
        jsonParams.put("answer", answer.getText().toString());
        jsonParams.put("check", check.toString());
        jsonParams.put("casp", casp.getText().toString());
    } catch (JSONException e) {
        e.printStackTrace();
    }
    StringEntity entity = null;
    try {
        entity = new StringEntity(jsonParams.toString(), null);
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    client.post(getApplicationContext(), QUERY_URL, entity, "application/json", new JsonHttpResponseHandler() {

        @Override
        public void onStart() {
            // called before request is started
        }

        @Override
        public void onSuccess(int statusCode, Header[] headers, JSONObject jsonObject) {
            // called when response HTTP status is "200 OK"
            try {
                status[0] = jsonObject.get("status").toString();
                Log.d("recon", status[0]);
                if (status[0].equals("login")) {
                    login.allDelete();

                    //credit[0] = jsonObject.get("credit").toString();
                    //Log.d("recon", "credit " + credit[0]);
                    ArrayList<AbstractMap.SimpleEntry<String, String>> pairs = new ArrayList<AbstractMap.SimpleEntry<String, String>>();
                    pairs.add(new AbstractMap.SimpleEntry("username", login_name.getText().toString()));
                    pairs.add(new AbstractMap.SimpleEntry("password", password.getText().toString()));
                    pairs.add(new AbstractMap.SimpleEntry("site", ""));
                    pairs.add(new AbstractMap.SimpleEntry("type", ""));
                    //pairs.add(new AbstractMap.SimpleEntry("credit", credit[0]));
                    login.updateContact("login", 1, pairs);
                    Bundle dataBundle = new Bundle();
                    dataBundle.putString("username", login_name.getText().toString());
                    dataBundle.putString("password", password.getText().toString());
                    dataBundle.putString("state", "default");
                    dataBundle.putString("actionable", "site");
                    dataBundle.putString("tracker", "");
                    dataBundle.putString("trackerType", "");
                    dataBundle.putStringArrayList("category", category);
                    //dataBundle.putString("credit", credit[0]);

                    Intent intent = new Intent(getApplicationContext(), com.equalsd.recon.List.class);
                    intent.putExtras(dataBundle);

                    startActivity(intent);
                } else if (status[0].equals("ok")) {
                    Toast.makeText(getApplicationContext(), "Working...", Toast.LENGTH_LONG).show();
                    new RequestTask().execute("http://ada-veracity.com/signup-wrapContent.php?content=wrap");
                    clickWrapTitle = "License Agreement";
                    //alertDialogClick();
                } else {
                    Toast.makeText(getApplicationContext(), status[0], Toast.LENGTH_LONG).show();
                }
            } catch (JSONException e) {
                Log.d("recon", String.valueOf(e));
            }
        }

        @Override
        public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
            // called when response HTTP status is "4XX" (eg. 401, 403, 404)
            Log.d("recon", "error " + throwable);

            Toast.makeText(getApplicationContext(),
                    "Error:  " + statusCode + " Verify your Internet Connection is stable or working.",
                    Toast.LENGTH_LONG).show();
        }

        @Override
        public void onRetry(int retryNo) {
            // called when request is retried
        }
    });
}

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

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

From source file:com.evolup.test.IAPTest01.util.IabHelper.java

int querySkuDetails(Inventory inv, List<String> moreSkus) throws RemoteException, JSONException {
    logDebug("Querying SKU details.");
    ArrayList<String> skuList = new ArrayList<String>();
    skuList.addAll(inv.getAllOwnedSkus());
    if (moreSkus != null)
        skuList.addAll(moreSkus);/* w w w .j av  a 2s.  c o m*/

    if (skuList.size() == 0) {
        logDebug("queryPrices: nothing to do because there are no SKUs.");
        return BILLING_RESPONSE_RESULT_OK;
    }

    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);
    Bundle skuDetails = mService.getSkuDetails(3, mContext.getPackageName(), ITEM_TYPE_INAPP, querySkus);

    if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
        int response = getResponseCodeFromBundle(skuDetails);
        if (response != BILLING_RESPONSE_RESULT_OK) {
            logDebug("getSkuDetails() failed: " + getResponseDesc(response));
            return response;
        } else {
            logError("getSkuDetails() returned a bundle with neither an error nor a detail list.");
            return IABHELPER_BAD_RESPONSE;
        }
    }

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

    for (String thisResponse : responseList) {
        SkuDetails d = new SkuDetails(thisResponse);
        logDebug("Got sku details: " + d);
        inv.addSkuDetails(d);
    }
    return BILLING_RESPONSE_RESULT_OK;
}

From source file:com.cdvdev.subscriptiondemo.helpers.IabHelper.java

int querySkuDetails(String itemType, Inventory inv, List<String> moreSkus)
        throws RemoteException, JSONException {
    logDebug("Querying SKU details.");
    ArrayList<String> skuList = new ArrayList<String>();
    skuList.addAll(inv.getAllOwnedSkus(itemType));
    if (moreSkus != null) {
        for (String sku : moreSkus) {
            if (!skuList.contains(sku)) {
                skuList.add(sku);/*from ww w .java2 s .  c o m*/
            }
        }
    }

    if (skuList.size() == 0) {
        logDebug("queryPrices: nothing to do because there are no SKUs.");
        return BILLING_RESPONSE_RESULT_OK;
    }

    // Split the sku list in blocks of no more than 20 elements.
    ArrayList<ArrayList<String>> packs = new ArrayList<ArrayList<String>>();
    ArrayList<String> tempList;
    int n = skuList.size() / 20;
    int mod = skuList.size() % 20;
    for (int i = 0; i < n; i++) {
        tempList = new ArrayList<String>();
        for (String s : skuList.subList(i * 20, i * 20 + 20)) {
            tempList.add(s);
        }
        packs.add(tempList);
    }
    if (mod != 0) {
        tempList = new ArrayList<String>();
        for (String s : skuList.subList(n * 20, n * 20 + mod)) {
            tempList.add(s);
        }
        packs.add(tempList);
    }

    for (ArrayList<String> skuPartList : packs) {
        Bundle querySkus = new Bundle();
        querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuPartList);
        Bundle skuDetails = mIInAppBillingService.getSkuDetails(3, mContext.getPackageName(), itemType,
                querySkus);

        if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
            int response = getResponseCodeFromBundle(skuDetails);
            if (response != BILLING_RESPONSE_RESULT_OK) {
                logDebug("getSkuDetails() failed: " + getResponseDesc(response));
                return response;
            } else {
                logError("getSkuDetails() returned a bundle with neither an error nor a detail list.");
                return IABHELPER_BAD_RESPONSE;
            }
        }

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

        for (String thisResponse : responseList) {
            SkuDetails d = new SkuDetails(itemType, thisResponse);
            logDebug("Got sku details: " + d);
            inv.addSkuDetails(d);
        }
    }

    return BILLING_RESPONSE_RESULT_OK;
}

From source file:uk.co.pilllogger.billing.IabHelper.java

int querySkuDetails(Inventory inv, List<String> moreSkus) throws RemoteException, JSONException {
    if (mContext == null || mService == null) {
        return BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE;
    }//from w ww  .jav  a  2s  .co  m
    logDebug("Querying SKU details.");
    ArrayList<String> skuList = new ArrayList<String>();
    skuList.addAll(inv.getAllOwnedSkus());
    if (moreSkus != null)
        skuList.addAll(moreSkus);

    if (skuList.size() == 0) {
        logDebug("queryPrices: nothing to do because there are no SKUs.");
        return BILLING_RESPONSE_RESULT_OK;
    }

    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);
    Bundle skuDetails = mService.getSkuDetails(3, mContext.getPackageName(), ITEM_TYPE_INAPP, querySkus);

    if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
        int response = getResponseCodeFromBundle(skuDetails);
        if (response != BILLING_RESPONSE_RESULT_OK) {
            logDebug("getSkuDetails() failed: " + getResponseDesc(response));
            return response;
        } else {
            logError("getSkuDetails() returned a bundle with neither an error nor a detail list.");
            return IABHELPER_BAD_RESPONSE;
        }
    }

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

    for (String thisResponse : responseList) {
        SkuDetails d = new SkuDetails(thisResponse);
        logDebug("Got sku details: " + d);
        inv.addSkuDetails(d);
    }
    return BILLING_RESPONSE_RESULT_OK;
}

From source file:mc.inappbilling.v3.InAppBillingHelper.java

int querySkuDetails(Inventory inv, List<String> moreSkus) throws RemoteException, JSONException {
    logDebug("Querying SKU details.");
    ArrayList<String> skuList = new ArrayList<String>();
    skuList.addAll(inv.getAllOwnedSkus());
    if (moreSkus != null)
        skuList.addAll(moreSkus);/* w  ww  . ja va 2s. c  o  m*/

    if (skuList.size() == 0) {
        logDebug("queryPrices: nothing to do because there are no SKUs.");
        return BILLING_RESPONSE_RESULT_OK;
    }

    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);
    Bundle skuDetails = mService.getSkuDetails(3, mContext.getPackageName(), ITEM_TYPE_INAPP, querySkus);

    if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
        int response = getResponseCodeFromBundle(skuDetails);
        if (response != BILLING_RESPONSE_RESULT_OK) {
            logDebug("getSkuDetails() failed: " + getResponseDesc(response));
            return response;
        } else {
            logError("getSkuDetails() returned a bundle with neither an error nor a detail list.");
            return IABHELPER_BAD_RESPONSE;
        }
    }

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

    for (String thisResponse : responseList) {
        Product p = new Product(thisResponse);
        logDebug("Got sku details: " + p);
        inv.addProducts(p);
    }
    return BILLING_RESPONSE_RESULT_OK;
}

From source file:org.runbuddy.tomahawk.ui.fragments.ContextMenuFragment.java

private void showAddToPlaylist(final TomahawkMainActivity activity, final List<Query> queries) {
    User.getSelf().done(new DoneCallback<User>() {
        @Override/*from  w  w w  .j a  v  a2s . co m*/
        public void onDone(User user) {
            ArrayList<String> queryKeys = new ArrayList<>();
            for (Query query : queries) {
                queryKeys.add(query.getCacheKey());
            }
            Bundle bundle = new Bundle();
            bundle.putString(TomahawkFragment.USER, user.getId());
            bundle.putInt(TomahawkFragment.CONTENT_HEADER_MODE, ContentHeaderFragment.MODE_HEADER_STATIC);
            bundle.putStringArrayList(TomahawkFragment.QUERYARRAY, queryKeys);
            FragmentUtils.replace(activity, PlaylistsFragment.class, bundle);
        }
    });
}

From source file:com.ovrhere.android.careerstack.ui.MainActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putStringArrayList(KEY_FRAG_TAG_TACK, fragTagStack.getArrayList());
    outState.putSerializable(KEY_FRAG_SAVED_STATES, fragSavedStates);
    outState.putString(KEY_ACTIONBAR_TITLE, actionBarTitle);

    outState.putBundle(KEY_CURRENT_SEARCH_BAR_STATE, currSearchBarState);
}

From source file:org.onepf.life2.oms.appstore.googleUtils.IabHelper.java

int querySkuDetails(String itemType, Inventory inv, List<String> moreSkus)
        throws RemoteException, JSONException {
    logDebug("Querying SKU details.");
    ArrayList<String> skuList = new ArrayList<String>();
    skuList.addAll(inv.getAllOwnedSkus(itemType));
    if (moreSkus != null)
        skuList.addAll(moreSkus);/*from  ww w .  jav  a2s . c o  m*/

    if (skuList.size() == 0) {
        logDebug("queryPrices: nothing to do because there are no SKUs.");
        return BILLING_RESPONSE_RESULT_OK;
    }

    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);
    Bundle skuDetails = mService.getSkuDetails(3, getPackageName(), itemType, querySkus);

    if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
        int response = getResponseCodeFromBundle(skuDetails);
        if (response != BILLING_RESPONSE_RESULT_OK) {
            logDebug("getSkuDetails() failed: " + getResponseDesc(response));
            return response;
        } else {
            logError("getSkuDetails() returned a bundle with neither an error nor a detail list.");
            return IABHELPER_BAD_RESPONSE;
        }
    }

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

    for (String thisResponse : responseList) {
        SkuDetails d = new SkuDetails(itemType, thisResponse);
        logDebug("Got sku details: " + d);
        inv.addSkuDetails(d);
    }
    return BILLING_RESPONSE_RESULT_OK;
}