Example usage for android.os Bundle getStringArrayList

List of usage examples for android.os Bundle getStringArrayList

Introduction

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

Prototype

@Override
@Nullable
public ArrayList<String> getStringArrayList(@Nullable String key) 

Source Link

Document

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Usage

From source file:cn.jasonlv.siri.activity.MainActivity.java

@Override
public void onResults(Bundle results) {
    long end2finish = System.currentTimeMillis() - speechEndTime;
    status = STATUS_None;/*from   ww  w . j  av a 2s  . c  o m*/
    ArrayList<String> nbest = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
    print("?" + Arrays.toString(nbest.toArray(new String[nbest.size()])));
    String json_res = results.getString("origin_result");
    Log.e(LOG_TAG, json_res);

    View inputPanel = getLayoutInflater().inflate(R.layout.input_layout, null);
    TextView inputTextView = (TextView) inputPanel.findViewById(R.id.input_text);
    inputTextView.setText(nbest.get(0));
    inputPanel.setFocusable(true);
    inputPanel.setFocusableInTouchMode(true);
    container.addView(inputPanel);

    //View fragmentContainer = getLayoutInflater().inflate(R.layout.fragment_container_layout, null);
    //container.addView(fragmentContainer);

    FrameLayout fragmentContainer = new FrameLayout(this);
    fragmentContainer.setId(fragmentConatainerId);
    fragmentContainer.setFocusable(true);
    fragmentContainer.setFocusableInTouchMode(true);

    container.addView(fragmentContainer);
    onProcessingResult(nbest, json_res, fragmentConatainerId);
    fragmentConatainerId++;

    scrollView.post(new Runnable() {
        @Override
        public void run() {
            scrollView.fullScroll(View.FOCUS_DOWN);
        }
    });
}

From source file:com.appsimobile.appsii.iab.IabInventoryHelper.java

private int queryPurchases(Inventory inv, String itemType) throws JSONException, RemoteException {
    // Query purchases
    logDebug("Querying owned items, item type: " + itemType);
    logDebug("Package name: " + mContext.getPackageName());
    boolean verificationFailed = false;
    String continueToken = null;/*from w w w  . j  a v a  2  s .c  om*/

    do {
        logDebug("Calling getPurchases with continuation token: " + continueToken);
        Bundle ownedItems = mService.getPurchases(3, mContext.getPackageName(), itemType, continueToken);

        int response = getResponseCodeFromBundle(ownedItems);
        logDebug("Owned items response: " + String.valueOf(response));
        if (response != BILLING_RESPONSE_RESULT_OK) {
            logDebug("getPurchases() failed: " + getResponseDesc(response));
            return response;
        }
        if (!ownedItems.containsKey(RESPONSE_INAPP_ITEM_LIST)
                || !ownedItems.containsKey(RESPONSE_INAPP_PURCHASE_DATA_LIST)
                || !ownedItems.containsKey(RESPONSE_INAPP_SIGNATURE_LIST)) {
            logError("Bundle returned from getPurchases() doesn't contain required fields.");
            return IABHELPER_BAD_RESPONSE;
        }

        ArrayList<String> ownedSkus = ownedItems.getStringArrayList(RESPONSE_INAPP_ITEM_LIST);
        ArrayList<String> purchaseDataList = ownedItems.getStringArrayList(RESPONSE_INAPP_PURCHASE_DATA_LIST);
        ArrayList<String> signatureList = ownedItems.getStringArrayList(RESPONSE_INAPP_SIGNATURE_LIST);

        for (int i = 0; i < purchaseDataList.size(); ++i) {
            String purchaseData = purchaseDataList.get(i);
            String signature = signatureList.get(i);
            String sku = ownedSkus.get(i);
            if (Security.verifyPurchase(mSignatureBase64, purchaseData, signature)) {
                logDebug("Sku is owned: " + sku);
                Purchase purchase = new Purchase(itemType, purchaseData, signature);

                if (TextUtils.isEmpty(purchase.getToken())) {
                    logWarn("BUG: empty/null token!");
                    logDebug("Purchase data: " + purchaseData);
                }

                // Record ownership and token
                inv.addPurchase(purchase);
            } else {
                logWarn("Purchase signature verification **FAILED**. Not adding item.");
                logDebug("   Purchase data: " + purchaseData);
                logDebug("   Signature: " + signature);
                verificationFailed = true;
            }
        }

        continueToken = ownedItems.getString(INAPP_CONTINUATION_TOKEN);
        logDebug("Continuation token: " + continueToken);
    } while (!TextUtils.isEmpty(continueToken));

    return verificationFailed ? IABHELPER_VERIFICATION_FAILED : BILLING_RESPONSE_RESULT_OK;
}

From source file:com.money.manager.ex.account.AccountTransactionListFragment.java

private void restoreInstanceState(Bundle savedInstanceState) {
    if (savedInstanceState == null)
        return;//from w  w  w.  j  av a2s. c  o m

    mAccountId = savedInstanceState.getInt(KEY_CONTENT);

    mFilter.transactionStatus.filter = savedInstanceState.getStringArrayList(KEY_STATUS);
}

From source file:com.google.cloud.android.speech.MainActivity.java

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

    final Resources resources = getResources();
    final Resources.Theme theme = getTheme();
    mColorHearing = ResourcesCompat.getColor(resources, R.color.status_hearing, theme);
    mColorNotHearing = ResourcesCompat.getColor(resources, R.color.status_not_hearing, theme);

    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
    mStatus = (TextView) findViewById(R.id.status);
    mText = (TextView) findViewById(R.id.text);

    mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    final ArrayList<String> results = savedInstanceState == null ? null
            : savedInstanceState.getStringArrayList(STATE_RESULTS);
    mAdapter = new ResultAdapter(results);
    mRecyclerView.setAdapter(mAdapter);/*from ww  w .  j  a  va  2 s  . c o  m*/

    prepareApi();
}

From source file:com.nokia.example.paymentoneapk.PaymentOneAPKActivity.java

private void queryProductDetails() {
    Log.d(TAG, "PaymentOneAPKActivity.queryProductDetails");

    final Bundle querySkus = new Bundle();

    querySkus.putStringArrayList("ITEM_ID_LIST", productSkus);

    new Thread(new Runnable() {
        @SuppressWarnings("CollectionDeclaredAsConcreteClass")
        @Override//from  www.  ja  v a  2s. co  m
        public void run() {

            final Bundle skuDetails;
            try {

                skuDetails = mService.getSkuDetails(API_VERSION, getPackageName(), "inapp", querySkus);

            } catch (final RemoteException e) {
                Log.e(TAG, "query error", e);
                return;
            }

            final int response = skuDetails.getInt("RESPONSE_CODE");
            Log.d(TAG, String.format("response = %d", response));

            if (response != PaymentOneAPKUtils.RESULT_OK) {

                toastMessage(
                        String.format("Got invalid response while doing query: %s", getErrorMessage(response)));

                return;
            }

            final ArrayList<String> responseList = skuDetails.getStringArrayList("DETAILS_LIST");

            for (final String resp : responseList) {
                Log.d(TAG, String.format("resp = %s", resp));
            }

            toastMessage("Item query done");

        }
    }).start();
}

From source file:org.fs.galleon.presenters.ToolsFragmentPresenter.java

@Override
public void restoreState(Bundle restoreState) {
    if (restoreState != null) {
        if (restoreState.containsKey(KEY_TEMP_TAKEN_PHOTO)) {
            String absolutePath = restoreState.getString(KEY_TEMP_TAKEN_PHOTO);
            if (!StringUtility.isNullOrEmpty(absolutePath)) {
                tempTakenPhoto = new File(absolutePath);
            }/*from   ww  w.  jav a 2s. com*/
        }
        if (restoreState.containsKey(KEY_IMAGE_ENTITIES)) {
            images = restoreState.getParcelableArrayList(KEY_IMAGE_ENTITIES);
        }
        if (restoreState.containsKey(KEY_PDF_FILES)) {
            List<String> absolutePaths = restoreState.getStringArrayList(KEY_PDF_FILES);
            if (!Collections.isNullOrEmpty(absolutePaths)) {
                List<File> fileList = StreamSupport.stream(absolutePaths).map(File::new)
                        .collect(Collectors.toList());
                pdfs.addAll(fileList);
            }
        }
    }
}

From source file:io.github.hidroh.materialistic.widget.StoryRecyclerViewAdapter.java

@Override
public void restoreState(Bundle savedState) {
    if (savedState == null) {
        return;/*from  w ww  . j  a  v a2s  . c  o  m*/
    }
    super.restoreState(savedState);
    ArrayList<Item> savedItems = savedState.getParcelableArrayList(STATE_ITEMS);
    setItemsInternal(savedItems);
    mUpdated = savedState.getParcelableArrayList(STATE_UPDATED);
    if (mUpdated != null) {
        for (int i = 0; i < mUpdated.size(); i++) {
            mUpdatedPositions.put(mUpdated.get(i).getLongId(), i);
        }
    }
    ArrayList<String> promotedKey = savedState.getStringArrayList(STATE_PROMOTED_KEY);
    ArrayList<Integer> promotedValue = savedState.getIntegerArrayList(STATE_PROMOTED_VALUE);
    mPromoted.clear();
    //noinspection ConstantConditions
    for (int i = 0; i < promotedKey.size(); i++) {
        //noinspection ConstantConditions
        mPromoted.put(promotedKey.get(i), promotedValue.get(i));
    }
    mShowAll = savedState.getBoolean(STATE_SHOW_ALL, true);
    mHighlightUpdated = savedState.getBoolean(STATE_HIGHLIGHT_UPDATED, true);
    mFavoriteRevision = savedState.getInt(STATE_FAVORITE_REVISION);
    mUsername = savedState.getString(STATE_USERNAME);
}

From source file:com.money.manager.ex.fragment.AllDataFragment.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    if (getSearResultFragmentLoaderCallbacks() != null)
        getSearResultFragmentLoaderCallbacks().onCallbackCreateLoader(id, args);
    //animation//from   w ww  .j  ava  2  s.co  m
    setListShown(false);

    switch (id) {
    case ID_LOADER_ALL_DATA_DETAIL:
        QueryAllData allData = new QueryAllData(getActivity());
        // compose selection and sort
        String selection = "", sort = "";
        if (args != null && args.containsKey(KEY_ARGUMENTS_WHERE)) {
            ArrayList<String> whereClause = args.getStringArrayList(KEY_ARGUMENTS_WHERE);
            if (whereClause != null) {
                for (int i = 0; i < whereClause.size(); i++) {
                    selection += (!TextUtils.isEmpty(selection) ? " AND " : "") + whereClause.get(i);
                }
            }
        }
        // set sort
        if (args != null && args.containsKey(KEY_ARGUMENTS_SORT)) {
            sort = args.getString(KEY_ARGUMENTS_SORT);
        }
        // create loader
        return new CursorLoader(getActivity(), allData.getUri(), allData.getAllColumns(), selection, null,
                sort);
    }
    return null;
}

From source file:org.sufficientlysecure.keychain.ui.CreateKeyActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // React on NDEF_DISCOVERED from Manifest
    // NOTE: ACTION_NDEF_DISCOVERED and not ACTION_TAG_DISCOVERED like in BaseNfcActivity
    if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(getIntent().getAction())) {

        mNfcTagDispatcher.interceptIntent(getIntent());

        setTitle(R.string.title_manage_my_keys);

        // done//from ww  w  .  ja  va 2 s  .  c om
        return;
    }

    // Check whether we're recreating a previously destroyed instance
    if (savedInstanceState != null) {
        // Restore value of members from saved state
        mName = savedInstanceState.getString(EXTRA_NAME);
        mEmail = savedInstanceState.getString(EXTRA_EMAIL);
        mAdditionalEmails = savedInstanceState.getStringArrayList(EXTRA_ADDITIONAL_EMAILS);
        mPassphrase = savedInstanceState.getParcelable(EXTRA_PASSPHRASE);
        mFirstTime = savedInstanceState.getBoolean(EXTRA_FIRST_TIME);
        mCreateSecurityToken = savedInstanceState.getBoolean(EXTRA_CREATE_SECURITY_TOKEN);
        mSecurityTokenAid = savedInstanceState.getByteArray(EXTRA_SECURITY_TOKEN_AID);
        mSecurityTokenPin = savedInstanceState.getParcelable(EXTRA_SECURITY_TOKEN_PIN);
        mSecurityTokenAdminPin = savedInstanceState.getParcelable(EXTRA_SECURITY_TOKEN_ADMIN_PIN);

        mCurrentFragment = getSupportFragmentManager().findFragmentByTag(FRAGMENT_TAG);
    } else {

        Intent intent = getIntent();
        // Initialize members with default values for a new instance
        mName = intent.getStringExtra(EXTRA_NAME);
        mEmail = intent.getStringExtra(EXTRA_EMAIL);
        mFirstTime = intent.getBooleanExtra(EXTRA_FIRST_TIME, false);
        mCreateSecurityToken = intent.getBooleanExtra(EXTRA_CREATE_SECURITY_TOKEN, false);

        if (intent.hasExtra(EXTRA_SECURITY_FINGERPRINTS)) {
            byte[] nfcFingerprints = intent.getByteArrayExtra(EXTRA_SECURITY_FINGERPRINTS);
            String nfcUserId = intent.getStringExtra(EXTRA_SECURITY_TOKEN_USER_ID);
            byte[] nfcAid = intent.getByteArrayExtra(EXTRA_SECURITY_TOKEN_AID);

            if (containsKeys(nfcFingerprints)) {
                Fragment frag = CreateSecurityTokenImportResetFragment.newInstance(nfcFingerprints, nfcAid,
                        nfcUserId);
                loadFragment(frag, FragAction.START);

                setTitle(R.string.title_import_keys);
            } else {
                Fragment frag = CreateSecurityTokenBlankFragment.newInstance(nfcAid);
                loadFragment(frag, FragAction.START);
                setTitle(R.string.title_manage_my_keys);
            }

            // done
            return;
        }

        // normal key creation
        CreateKeyStartFragment frag = CreateKeyStartFragment.newInstance();
        loadFragment(frag, FragAction.START);
    }

    if (mFirstTime) {
        setTitle(R.string.app_name);
        mToolbar.setNavigationIcon(null);
        mToolbar.setNavigationOnClickListener(null);
    } else {
        setTitle(R.string.title_manage_my_keys);
    }
}

From source file:com.facebook.widget.FacebookDialog.java

static private String getEventName(Intent intent) {
    String action = intent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION);
    boolean hasPhotos = intent.hasExtra(NativeProtocol.EXTRA_PHOTOS);
    boolean hasVideo = false;

    Bundle extras = intent.getBundleExtra(NativeProtocol.EXTRA_PROTOCOL_METHOD_ARGS);
    if (extras != null) {
        ArrayList<String> photo = extras.getStringArrayList(NativeProtocol.METHOD_ARGS_PHOTOS);
        String video = extras.getString(NativeProtocol.METHOD_ARGS_VIDEO);
        if (photo != null && !photo.isEmpty()) {
            hasPhotos = true;/*from   ww w . ja va2  s  . co m*/
        }
        if (video != null && !video.isEmpty()) {
            hasVideo = true;
        }
    }
    return getEventName(action, hasPhotos, hasVideo);
}