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:com.corumgaz.mobilsayac.VoiceRecognizer.LanguageDetailsChecker.java

@Override
public void onReceive(Context context, Intent intent) {
    Bundle results = getResultExtras(true);

    // get the list of supported languages
    if (results.containsKey(RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES)) {
        // Convert the map to json
        supportedLanguages = results.getStringArrayList(RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES);
        JSONArray jsonLanguages = new JSONArray(supportedLanguages);
        callbackContext.success(jsonLanguages);
    } else {/*from   ww  w .jav a2 s . c  om*/
        callbackContext.error("Could not retrieve the list of supported languages");
    }
}

From source file:org.nick.ghettounlock.GhettoTrustAgent.java

@Override
public boolean onSetTrustAgentFeaturesEnabled(Bundle options) {
    Log.v(TAG, "Policy options received: " + options.getStringArrayList(KEY_FEATURES));

    return true; // inform DPM that we support it
}

From source file:me.tabak.fragmentswitcher.sample.SampleFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState == null) {
        mRandomStrings = generateRandomStrings();
    } else {/*from w  w w  . ja  v  a2  s .  c o  m*/
        mRandomStrings = savedInstanceState.getStringArrayList(KEY_RANDOM_STRINGS);
    }
    initializeAdapter();
}

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

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (savedInstanceState != null) {
        keys = savedInstanceState.getStringArrayList(IntentSenderActivity.INTENT_KEYS);
        exportedReceiverName = savedInstanceState
                .getString(ExportedReceiverListFragment.EXPORTED_RECEIVER_NAME);
        exportedReceiverId = savedInstanceState.getString(ExportedReceiverListFragment.EXPORTED_RECEIVER_ID);
    } else {/* w ww. ja  v a 2 s .  c om*/
        Bundle bundle = getArguments();
        if (bundle != null) {
            keys = bundle.getStringArrayList(IntentSenderActivity.INTENT_KEYS);
            exportedReceiverName = bundle.getString(ExportedReceiverListFragment.EXPORTED_RECEIVER_NAME);
            exportedReceiverId = bundle.getString(ExportedReceiverListFragment.EXPORTED_RECEIVER_ID);
        }
    }

    if (keys == null || keys.isEmpty()) {
        throw new IllegalArgumentException("Keys null");
    }

    LinearLayout paramsLayout = (LinearLayout) getView().findViewById(R.id.paramsLayout);

    for (String key : keys) {
        createKeyValuePairLayout(key, paramsLayout);

    }
    Button button = (Button) getView().findViewById(R.id.submitButton);
    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View arg0) {
            sendBroadcast();
        }
    });
}

From source file:com.cbtec.eliademy.BillingPlugin.java

private void getPurchasedItems(CallbackContext callbackContext) {
    try {/*from w w w.  jav  a2s .  co  m*/
        JSONArray products = new JSONArray();

        Bundle ownedItems = Eliademy.sBillingService.getPurchases(3, Eliademy.sInstance.getPackageName(),
                "inapp", null);

        if (ownedItems.getInt("RESPONSE_CODE") == 0) {
            final ArrayList<String> items = ownedItems.getStringArrayList("INAPP_PURCHASE_ITEM_LIST");

            for (int i = 0; i < items.size(); i++) {
                products.put(items.get(i));
            }
        }

        callbackContext.success(products);
    } catch (RemoteException e) {
        callbackContext.error(e.getMessage());
    }
}

From source file:com.commonsware.android.ab.search.ActionBarFragment.java

@Override
public void onViewCreated(View v, Bundle savedInstanceState) {
    super.onViewCreated(v, savedInstanceState);

    if (savedInstanceState == null) {
        initAdapter(null);//  w  ww.  jav  a2  s.  c  o m
    } else {
        initAdapter(savedInstanceState.getStringArrayList(STATE_MODEL));
        initialQuery = savedInstanceState.getCharSequence(STATE_QUERY);
    }
}

From source file:com.baidu.android.voicedemo.ActivityTouch.java

@Override
public void onPartialResults(Bundle partialResults) {
    ArrayList<String> nbest = partialResults.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
    if (nbest.size() > 0) {
        print("~" + Arrays.toString(nbest.toArray(new String[0])));
        txtResult.setText(nbest.get(0));
    }// w ww . j  a  v a2s  .co m
}

From source file:com.spoiledmilk.ibikecph.IssuesActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_issues);
    spinner = (Spinner) findViewById(R.id.spinner);
    Bundle data = getIntent().getExtras();
    turns = data.getStringArrayList("turns");
    startLoc = data.getString("startLoc");
    endLoc = data.getString("endLoc");
    startName = data.getString("startName");
    endName = data.getString("endName");
    IssuesAdapter dataAdapter = new IssuesAdapter(this, turns, R.layout.list_row_issues,
            R.layout.spinner_layout);//from   w w w  .j  a  v  a2 s  . co  m
    spinner.setAdapter(dataAdapter);
    textTitle = (TextView) findViewById(R.id.textTitle);
    textOption1 = (TextView) findViewById(R.id.textOption1);
    textOption2 = (TextView) findViewById(R.id.textOption2);
    textOption3 = (TextView) findViewById(R.id.textOption3);
    textOption4 = (TextView) findViewById(R.id.textOption4);
    textOption5 = (TextView) findViewById(R.id.textOption5);
    textOption6 = (TextView) findViewById(R.id.textOption6);
    textComment1 = (EditText) findViewById(R.id.textComment1);
    textComment2 = (EditText) findViewById(R.id.textComment2);
    textComment3 = (EditText) findViewById(R.id.textComment3);
    textComment4 = (EditText) findViewById(R.id.textComment4);
    textComment5 = (EditText) findViewById(R.id.textComment5);
    textComment6 = (EditText) findViewById(R.id.textComment6);
    imgRadio1 = (ImageView) findViewById(R.id.imgRadio1);
    imgRadio2 = (ImageView) findViewById(R.id.imgRadio2);
    imgRadio3 = (ImageView) findViewById(R.id.imgRadio3);
    imgRadio4 = (ImageView) findViewById(R.id.imgRadio4);
    imgRadio5 = (ImageView) findViewById(R.id.imgRadio5);
    imgRadio6 = (ImageView) findViewById(R.id.imgRadio6);
    btnSend = (TexturedButton) findViewById(R.id.btnSend);
    btnSend.setTextureResource(R.drawable.btn_pattern_repeteable);
    btnSend.setBackgroundResource(R.drawable.btn_blue_selector);
    btnSend.setTextColor(Color.WHITE);
    IbikeApplication.getTracker().sendEvent("Report", "Start", "", (long) 0);
    deselectAll();
}

From source file:com.owner.disclosureyourlife.ImagePagerActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.ac_image_pager);

    back = (Button) findViewById(R.id.back);
    title = (TextView) findViewById(R.id.embarrassTitle);
    title.setText(getString(R.string.plain_look_view_pager_title));
    back.setOnClickListener(l);// www .jav a  2s.  co m
    Bundle bundle = getIntent().getExtras();
    assert bundle != null;
    imageUrls = bundle.getStringArrayList(Extra.IMAGES);
    ids = bundle.getIntegerArrayList(Extra.IDS);
    counts = bundle.getIntegerArrayList(Extra.COUNTS);
    bcounts = bundle.getIntegerArrayList(Extra.BCOUNTS);
    int pagerPosition = bundle.getInt(Extra.IMAGE_POSITION, 0);

    if (savedInstanceState != null) {
        pagerPosition = savedInstanceState.getInt(STATE_POSITION);
    }

    options = new DisplayImageOptions.Builder().showImageForEmptyUri(R.drawable.ic_empty)
            .showImageOnFail(R.drawable.ic_error).resetViewBeforeLoading(true).cacheOnDisc(true)
            .imageScaleType(ImageScaleType.EXACTLY).bitmapConfig(Bitmap.Config.RGB_565).considerExifParams(true)
            .displayer(new FadeInBitmapDisplayer(300)).build();

    pager = (ViewPager) findViewById(R.id.pager);
    pager.setAdapter(new ImagePagerAdapter(imageUrls));
    pager.setCurrentItem(pagerPosition);
}

From source file:com.secbro.qark.exportedcomponent.exportedactivity.IntentParamsFragment.java

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (savedInstanceState != null) {
        keys = savedInstanceState.getStringArrayList(IntentSenderActivity.INTENT_KEYS);
        exportedActivityName = savedInstanceState
                .getString(ExportedActivityListFragment.EXPORTED_ACTIVITY_NAME);
        exportedActivityId = savedInstanceState.getString(ExportedActivityListFragment.EXPORTED_ACTIVITY_ID);
    } else {//w  w  w .j a  v a2 s  . co m
        Bundle bundle = getArguments();
        if (bundle != null) {
            keys = bundle.getStringArrayList(IntentSenderActivity.INTENT_KEYS);
            exportedActivityName = bundle.getString(ExportedActivityListFragment.EXPORTED_ACTIVITY_NAME);
            exportedActivityId = bundle.getString(ExportedActivityListFragment.EXPORTED_ACTIVITY_ID);
        }
    }

    if (keys == null || keys.isEmpty()) {
        throw new IllegalArgumentException("Keys null");
    }

    LinearLayout paramsLayout = (LinearLayout) getView().findViewById(R.id.paramsLayout);

    for (String key : keys) {
        createKeyValuePairLayout(key, paramsLayout);
    }

    Button button = (Button) getView().findViewById(R.id.submitButton);
    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View arg0) {
            Intent intent = new Intent();
            intent.setComponent(
                    new ComponentName(getResources().getString(R.string.packageName), exportedActivityName));
            for (String key : keys) {
                intent.putExtra(((TextView) getView().findViewWithTag("key" + key)).getText().toString(),
                        ((EditText) getView().findViewWithTag("value" + key)).getText().toString());

            }
            startActivityForResult(intent, REQUEST_CODE);
            Toast.makeText(getActivity(), "Intent sent", Toast.LENGTH_LONG).show();
        }
    });
}