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.nextgis.maplibui.util.TrackView.java

@Override
public void onRestoreInstanceState(Parcelable state) {
    if (state instanceof Bundle) {
        Bundle bundle = (Bundle) state;

        if (bundle.containsKey(BUNDLE_SELECTED_ITEMS_ID))
            mSelectedIds = bundle.getStringArrayList(BUNDLE_SELECTED_ITEMS_ID);

        super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
        return;/*from   w ww  .  jav  a  2 s.  c om*/
    }

    super.onRestoreInstanceState(state);
}

From source file:com.lloydtorres.stately.helpers.NameListDialog.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_dialog_recycler, container, false);

    // Restore saved state
    if (savedInstanceState != null) {
        title = savedInstanceState.getString(TITLE_KEY);
        names = savedInstanceState.getStringArrayList(NAMES_KEY);
        target = savedInstanceState.getInt(TARGET_KEY);
    }//w w  w.j av a  2s .c  o m

    getDialog().setTitle(title);
    initRecycler(view);

    return view;
}

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

@Override
public void onResults(Bundle results) {
    long end2finish = System.currentTimeMillis() - speechEndTime;
    ArrayList<String> nbest = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
    print("?" + Arrays.toString(nbest.toArray(new String[nbest.size()])));
    String json_res = results.getString("origin_result");
    try {//from  w ww  .  j a  v  a2s  .c o m
        print("origin_result=\n" + new JSONObject(json_res).toString(4));
    } catch (Exception e) {
        print("origin_result=[warning: bad json]\n" + json_res);
    }
    btn.setText("");
    String strEnd2Finish = "";
    if (end2finish < 60 * 1000) {
        strEnd2Finish = "(waited " + end2finish + "ms)";
    }
    txtResult.setText(nbest.get(0) + strEnd2Finish);
}

From source file:net.kourlas.voipms_sms.Billing.java

public void preDonation(final Activity sourceActivity) {
    try {//ww  w  .  j a  v a 2  s . c o  m
        Bundle ownedItems = billingService.getPurchases(3, applicationContext.getPackageName(), "inapp", null);
        int response = ownedItems.getInt("RESPONSE_CODE");
        if (response == 0) {
            List<String> purchaseDataList = ownedItems.getStringArrayList("INAPP_PURCHASE_DATA_LIST");
            for (String purchaseData : purchaseDataList) {
                JSONObject json = new JSONObject(purchaseData);
                String pid = json.getString("productId");
                final String token = json.getString("purchaseToken");

                if (pid.equals(applicationContext.getString(R.string.billing_pid_donation))) {
                    new AsyncTask<Void, Void, Void>() {
                        @Override
                        protected Void doInBackground(Void... params) {
                            try {
                                billingService.consumePurchase(3, sourceActivity.getPackageName(), token);
                            } catch (Exception ignored) {
                                // Do nothing.
                            }
                            return null;
                        }

                        @Override
                        protected void onPostExecute(Void aVoid) {
                            showDonationDialog(sourceActivity);
                        }
                    }.execute();
                    return;
                }
            }
        }
    } catch (Exception ignored) {
        // Do nothing.
    }

    showDonationDialog(sourceActivity);
}

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

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

    // try to get the bundle from the arguments
    Bundle bundleArg = getArguments();//from   w ww .  ja v a2  s.c  o  m
    Bundle bundleInt = getActivity().getIntent().getExtras();

    if (bundleInt != null) {
        focusedElementID = BundleExtra.getBundleString(bundleInt, BundleExtra.CURRENT_ID,
                BundleExtra.DefaultValues.DEFAULT_ID);
        songsIDs = bundleInt.getStringArrayList(BundleExtra.SONGS_ID_LIST);
        addRandomButton = bundleInt.getBoolean(ADD_PLAYALLRANDOM_BUTTON, false);
    } else {
        focusedElementID = BundleExtra.getBundleString(bundleArg, BundleExtra.CURRENT_ID,
                BundleExtra.DefaultValues.DEFAULT_ID);
        songsIDs = bundleArg.getStringArrayList(BundleExtra.SONGS_ID_LIST);
        addRandomButton = bundleArg.getBoolean(ADD_PLAYALLRANDOM_BUTTON, false);
    }

    myAdapter = new SongsListActivityAdapter(this.getActivity(), focusedElementID, songsIDs, addRandomButton);
}

From source file:com.kaliturin.blacklist.fragments.SMSSendFragment.java

private void addRowsToContactsList(Bundle data) {
    if (data == null) {
        return;/*from ww  w  . jav  a 2  s.c  om*/
    }
    ArrayList<String> numbers = data.getStringArrayList(CONTACT_NUMBERS);
    ArrayList<String> names = data.getStringArrayList(CONTACT_NAMES);
    if (numbers != null && names != null && numbers.size() == names.size()) {
        for (int i = 0; i < numbers.size(); i++) {
            String number = numbers.get(i);
            String name = names.get(i);
            addRowToContactsList(number, name);
        }
    }
}

From source file:net.xisberto.phonetodesktop.LinkListActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_link_list);

    if ((savedInstanceState != null) && savedInstanceState.containsKey("titles")) {
        titles = savedInstanceState.getStringArrayList("titles");
        ids = savedInstanceState.getStringArrayList("ids");
        done = savedInstanceState.getBoolean("done");
    } else {//  w  w  w.  ja v  a  2s .com
        titles = null;
        ids = null;
        done = true;
    }
}

From source file:org.barbon.mangaget.fragments.MangaSearchResults.java

public void performSearch(Intent intent) {
    Scraper scraper = Scraper.getInstance(getActivity());
    String query = intent.getStringExtra(SearchManager.QUERY);
    Bundle extra = intent.getBundleExtra(SearchManager.APP_DATA);
    Scraper.SearchCriteria criteria = new Scraper.SearchCriteria();

    criteria.title = query;//w w w  .  j  ava2 s  .com
    if (extra != null)
        criteria.includeTags = extra.getStringArrayList("include_tags");

    setListAdapter(new SearchAdapter(getActivity(), scraper, criteria));
}

From source file:angeloid.dreamnarae.TTS_Biling.java

void Biling_Friends() {
    try {/*from  w  ww .  j  av  a 2s  .c om*/
        // Query Already Purchased
        Bundle ownedItems = mService.getPurchases(3, getPackageName(), "inapp", null);
        int response = ownedItems.getInt("RESPONSE_CODE");
        ArrayList<String> ownedSkus = null;

        if (response == 0)
            ownedSkus = ownedItems.getStringArrayList("INAPP_PURCHASE_ITEM_LIST");

        if (response == 0 && ownedSkus.size() > 0 && ownedSkus.get(0).equals(sku)) {
            SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
            SharedPreferences.Editor editor = sharedPref.edit();
            editor.putInt("License", TRUE);
            editor.commit();
            isPro = true;
        }

        // Purchase it

        Bundle buyIntentBundle = mService.getBuyIntent(3, getPackageName(), sku, "inapp", "");
        PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
        startIntentSenderForResult(pendingIntent.getIntentSender(), 1001, new Intent(), Integer.valueOf(0),
                Integer.valueOf(0), Integer.valueOf(0));

        // Check
        ownedItems = mService.getPurchases(3, getPackageName(), "inapp", null);
        response = ownedItems.getInt("RESPONSE_CODE");
        if (response == 0)
            ownedSkus = ownedItems.getStringArrayList("INAPP_PURCHASE_ITEM_LIST");

        if (response == 0 && ownedSkus.size() > 0 && ownedSkus.get(0).equals(sku)) {
            SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
            SharedPreferences.Editor editor = sharedPref.edit();
            editor.putInt("License", TRUE);
            editor.commit();
            isPro = true;
        }

    } catch (Exception e) {
    }
}

From source file:angeloid.dreamnarae.TTS_Biling.java

void Biling_Narae() {
    try {//from  w w w .j  a v  a  2  s  .c o  m
        // Query Already Purchased
        Bundle ownedItems = mService.getPurchases(3, getPackageName(), "inapp", null);
        int response = ownedItems.getInt("RESPONSE_CODE");
        ArrayList<String> ownedSkus = null;

        if (response == 0)
            ownedSkus = ownedItems.getStringArrayList("INAPP_PURCHASE_ITEM_LIST");

        if (response == 0 && ownedSkus.size() > 0 && ownedSkus.get(0).equals(sku)) {
            SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
            SharedPreferences.Editor editor = sharedPref.edit();
            editor.putInt("License", TRUE);
            editor.commit();
            isPro = true;
        }

        // Purchase it

        Bundle buyIntentBundle = mService.getBuyIntent(3, getPackageName(), sku, "inapp", "");
        PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
        startIntentSenderForResult(pendingIntent.getIntentSender(), 1001, new Intent(), Integer.valueOf(0),
                Integer.valueOf(0), Integer.valueOf(0));

        // Check
        ownedItems = mService.getPurchases(3, getPackageName(), "inapp", null);
        response = ownedItems.getInt("RESPONSE_CODE");
        if (response == 0)
            ownedSkus = ownedItems.getStringArrayList("INAPP_PURCHASE_ITEM_LIST");

        if (response == 0 && ownedSkus.size() > 0 && ownedSkus.get(0).equals(sku)) {
            SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
            SharedPreferences.Editor editor = sharedPref.edit();
            editor.putInt("License", TRUE);
            editor.commit();
            isPro = true;
        }

    } catch (Exception e) {
    }
}