Java Code Examples for android.os.Bundle.putStringArrayList()

The following are Jave code examples for showing how to use putStringArrayList() of the android.os.Bundle class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: SimpleDialogFragments   File: SimpleListDialog.java   View Source Code Vote up 7 votes
@Override
protected Bundle onResult(int which) {
    Bundle result = super.onResult(which);
    if (result != null) {

        ArrayList<Integer> positions = result.getIntegerArrayList(SELECTED_POSITIONS);
        if (positions != null) {
            ArrayList<String> labels = new ArrayList<>(positions.size());
            for (Integer pos : positions) {
                labels.add(mData.get(pos).getString());
            }
            result.putStringArrayList(SELECTED_LABELS, labels);
        }

        if (result.containsKey(SELECTED_SINGLE_POSITION)) {
            result.putString(SELECTED_SINGLE_LABEL, mData.get(
                    result.getInt(SELECTED_SINGLE_POSITION)).getString());
        }

    }
    return result;
}
 
Example 2
Project: Saiy-PS   File: SaiyAccessibilityService.java   View Source Code Vote up 6 votes
/**
 * Process the extracted text as identified as a command
 *
 * @param text the command to process
 */
private void process(@NonNull final String text) {
    if (DEBUG) {
        MyLog.i(CLS_NAME, "process");
    }

    final Bundle bundle = new Bundle();

    final ArrayList<String> voiceResults = new ArrayList<>(1);
    voiceResults.add(text);

    final float[] confidence = new float[1];
    confidence[0] = 1f;

    bundle.putStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION, voiceResults);
    bundle.putFloatArray(SpeechRecognizer.CONFIDENCE_SCORES, confidence);
    bundle.putInt(LocalRequest.EXTRA_CONDITION, Condition.CONDITION_GOOGLE_NOW);

    AsyncTask.execute(new Runnable() {
        @Override
        public void run() {
            new RecognitionAction(SaiyAccessibilityService.this.getApplicationContext(), SPH.getVRLocale(SaiyAccessibilityService.this.getApplicationContext()),
                    SPH.getTTSLocale(SaiyAccessibilityService.this.getApplicationContext()), sl, bundle);
        }
    });
}
 
Example 3
Project: kognitivo   File: NativeDialogParameters.java   View Source Code Vote up 6 votes
private static Bundle createBaseParameters(ShareContent content, boolean dataErrorsFatal) {
    Bundle params = new Bundle();

    Utility.putUri(params, ShareConstants.CONTENT_URL, content.getContentUrl());
    Utility.putNonEmptyString(params, ShareConstants.PLACE_ID, content.getPlaceId());
    Utility.putNonEmptyString(params, ShareConstants.REF, content.getRef());

    params.putBoolean(ShareConstants.DATA_FAILURES_FATAL, dataErrorsFatal);

    List<String> peopleIds = content.getPeopleIds();
    if (!Utility.isNullOrEmpty(peopleIds)) {
        params.putStringArrayList(
                ShareConstants.PEOPLE_IDS,
                new ArrayList<String>(peopleIds));
    }

    return params;
}
 
Example 4
Project: q-mail   File: Accounts.java   View Source Code Vote up 5 votes
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if (mSelectedContextAccount != null) {
        outState.putString(SELECTED_CONTEXT_ACCOUNT, mSelectedContextAccount.getUuid());
    }
    outState.putSerializable(STATE_UNREAD_COUNT, mUnreadMessageCount);
    outState.putSerializable(ACCOUNT_STATS, accountStats);

    outState.putBoolean(STATE_EXPORT_GLOBAL_SETTINGS, exportGlobalSettings);
    outState.putStringArrayList(STATE_EXPORT_ACCOUNTS, exportAccountUuids);
}
 
Example 5
Project: DistanceRangeBar   File: DistanceRangeBar.java   View Source Code Vote up 5 votes
@Override
public Parcelable onSaveInstanceState() {
    Bundle bundle = new Bundle();
    bundle.putParcelable("instanceState", super.onSaveInstanceState());
    bundle.putInt("TICK_COUNT", mTickCount);
    bundle.putInt("TICK_COLOR", mTickColor);
    bundle.putFloat("TICK_HEIGHT_DP", mTickHeightDP);
    bundle.putFloat("BAR_WEIGHT", mBarWeight);
    bundle.putInt("BAR_COLOR", mBarColor);
    bundle.putFloat("CIRCLE_SIZE", mCircleSize);
    bundle.putInt("CIRCLE_COLOR", mCircleColor);
    bundle.putInt("CIRCLE_BOUNDARY_COLOR", mCircleBoundaryColor);
    bundle.putFloat("CIRCLE_BOUNDARY_WIDTH", mCircleBoundarySize);
    bundle.putFloat("THUMB_RADIUS_DP", mThumbRadiusDP);
    bundle.putFloat("EXPANDED_PIN_RADIUS_DP", mExpandedPinRadius);
    bundle.putFloat("PIN_PADDING", mPinPadding);
    bundle.putFloat("BAR_PADDING_BOTTOM", mBarPaddingBottom);
    bundle.putInt("RIGHT_INDEX", mRightIndex);
    bundle.putFloat("MARGIN", mMargin);
    bundle.putInt("TICK_BOUNDARY_COLOR", mTickBoundaryColor);
    bundle.putFloat("TICK_BOUNDARY_WIDTH", mTickBoundaryWidth);
    bundle.putInt("EFFECT_COLOR", mEffectColor);
    bundle.putInt("CHOOSE_TEXT_COLOR", mChooseTextColor);
    bundle.putInt("UNCHOOSE_TEXT_COLOR", mUnChooseTextColor);
    bundle.putFloat("BAR_TEXT_SIZE", mBarTextSize);
    bundle.putFloat("BAR_TEXT_MARGIN_RANGE_BAR", mBarTextMarginRangeBar);
    bundle.putStringArrayList("LIST", mList);
    return bundle;
}
 
Example 6
Project: MyDemo   File: WelfareDetailActivity.java   View Source Code Vote up 5 votes
public static void launchActivity(Activity context, int position, ArrayList<String> imgList){
    Bundle bundle = new Bundle();
    bundle.putInt("position",position);
    bundle.putStringArrayList("imgList", imgList);
    Intent intent = new Intent(context, WelfareDetailActivity.class);
    intent.putExtras(bundle);
    context.startActivity(intent);
    context.overridePendingTransition(R.anim.fade_entry, R.anim.hold);
}
 
Example 7
Project: ucar-weex-core   File: JsonHelperImpl.java   View Source Code Vote up 5 votes
private Bundle json2Bundle(String json) {
    if (TextUtils.isEmpty(json)) {
        return null;
    }
    Bundle bundle = new Bundle();
    JSONObject jo = JSON.parseObject(json);

    Iterator<Map.Entry<String,Object>> iterator = jo.entrySet().iterator();
    Map.Entry<String,Object> entry;
    Object value;
    while (iterator.hasNext()){
        entry = iterator.next();
        value = entry.getValue();
        if (value != null) {
            if (value instanceof JSONArray) {
                JSONArray array = (JSONArray) value;
                ArrayList<String> strList = new ArrayList<String>(array.size());
                for (Object item : array) {
                    if (item != null) {
                        strList.add(String.valueOf(item));
                    }
                }
                bundle.putStringArrayList(entry.getKey(), strList);
            } else if (value instanceof Serializable) {
                bundle.putSerializable(entry.getKey(), (Serializable) value);
            } else if (value instanceof Parcelable) {
                bundle.putParcelable(entry.getKey(), (Parcelable) value);
            } else {
                bundle.putString(entry.getKey(), value.toString());
            }
        }

    }
    return bundle;
}
 
Example 8
Project: WeatherPlus   File: PermissionActivity.java   View Source Code Vote up 5 votes
@Override
protected void onSaveInstanceState(Bundle outState) {
    Log.d(TAG, "onSaveInstanceState: Save dialog state");
    super.onSaveInstanceState(outState);

    outState.putInt(KEY_SHOWING_DIALOG_COUNT, showingDialogCount);

    outState.putParcelableArrayList(KEY_DIALOG_MESSAGES,
            (ArrayList<? extends Parcelable>) dialogMessages);

    outState.putStringArrayList(KEY_REQUEST_QUEUE, (ArrayList<String>) requestQueue);

    outState.putInt(KEY_REQUEST_CODE, requestCode);
}
 
Example 9
Project: CouponsTracker   File: CouponListFragment.java   View Source Code Vote up 5 votes
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    DebugLog.logMethod();
    if (coupons != null) {
        DebugLog.logMessage("Coupons: " + coupons.size());
        outState.putParcelableArrayList(Constants.BUNDLE_EXTRA_COUPONS, coupons);
    }
    outState.putInt(
            Constants.BUNDLE_EXTRA_LIST_POSITION,
            ((LinearLayoutManager) recyclerView.getLayoutManager()).findFirstCompletelyVisibleItemPosition()
    );
    outState.putStringArrayList(Constants.BUNDLE_EXTRA_MERCHANT_SUGGESTIONS, merchants);
    outState.putStringArrayList(Constants.BUNDLE_EXTRA_CATEGORY_SUGGESTIONS, categories);
}
 
Example 10
Project: Camera-Roll-Android-App   File: SelectorModeManager.java   View Source Code Vote up 5 votes
public void saveInstanceState(Bundle outState) {
    boolean active = isSelectorModeActive();
    outState.putString(SELECTOR_MODE_ACTIVE, String.valueOf(active));
    if (active) {
        outState.putStringArrayList(SELECTED_ITEMS_PATHS, selected_items_paths);
    }
}
 
Example 11
Project: kognitivo   File: NativeDialogParameters.java   View Source Code Vote up 5 votes
private static Bundle create(
        SharePhotoContent photoContent,
        List<String> imageUrls,
        boolean dataErrorsFatal) {
    Bundle params = createBaseParameters(photoContent, dataErrorsFatal);

    params.putStringArrayList(ShareConstants.PHOTOS, new ArrayList<>(imageUrls));

    return params;
}
 
Example 12
Project: ESSocialSDK-master   File: QQShareProxy.java   View Source Code Vote up 5 votes
public static void shareToQZone(Context context, String appId, String title, String summary, String url,
                                String imageUrl, IUiListener listener) {
    Bundle params = new Bundle();
    params.putInt(QzoneShare.SHARE_TO_QZONE_KEY_TYPE, QzoneShare.SHARE_TO_QZONE_TYPE_IMAGE_TEXT);
    params.putString(QzoneShare.SHARE_TO_QQ_TITLE, title);
    params.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, summary);
    params.putString(QzoneShare.SHARE_TO_QQ_TARGET_URL, url);
    ArrayList<String> imgs = new ArrayList<String>();
    imgs.add(imageUrl);
    params.putStringArrayList(QzoneShare.SHARE_TO_QQ_IMAGE_URL, imgs);
    Tencent tencent = getInstance(context, appId);
    tencent.shareToQzone((Activity) context, params, listener);
}
 
Example 13
Project: ExVidPlayer   File: ExVidPlayerActivity.java   View Source Code Vote up 5 votes
private void setUpPlayer() {
  FragmentManager fragmentManager = getSupportFragmentManager();
  FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
  ExVpCompleteFragment exVpCompleteFragment = new ExVpCompleteFragment();
  Bundle bundle = new Bundle();
  bundle.putStringArrayList("urls", video_url);
  bundle.putStringArrayList("type", video_type);
  bundle.putInt("currentIndex", currentIndex);
  exVpCompleteFragment.setArguments(bundle);
  fragmentTransaction.add(R.id.parent, exVpCompleteFragment);
  fragmentTransaction.commit();
}
 
Example 14
Project: FBEventSync   File: CalendarSyncAdapter.java   View Source Code Vote up 5 votes
private boolean checkPermissions() {
    ArrayList<String> missingPermissions = new ArrayList<String>();
    int permissionCheck = ContextCompat.checkSelfPermission(getContext(), Manifest.permission.WRITE_CALENDAR);
    if (permissionCheck != PackageManager.PERMISSION_GRANTED) {
        missingPermissions.add(Manifest.permission.READ_CALENDAR);
        missingPermissions.add(Manifest.permission.WRITE_CALENDAR);
    }
    permissionCheck = ContextCompat.checkSelfPermission(getContext(), Manifest.permission.WRITE_SYNC_SETTINGS);
    if (permissionCheck != PackageManager.PERMISSION_GRANTED) {
        missingPermissions.add(Manifest.permission.ACCOUNT_MANAGER);
        missingPermissions.add(Manifest.permission.READ_SYNC_SETTINGS);
        missingPermissions.add(Manifest.permission.WRITE_SYNC_SETTINGS);
    }

    logger.info("SYNC.PERM", "Missing permissions: " + missingPermissions.toString());

    if (!missingPermissions.isEmpty()) {
        Bundle extras = new Bundle();
        extras.putStringArrayList(PermissionRequestActivity.MISSING_PERMISSIONS, missingPermissions);

        Intent intent = new Intent(getContext(), PermissionRequestActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.putExtras(extras);
        getContext().startActivity(intent);
        return false;
    }
    return true;
}
 
Example 15
Project: Elements   File: StringSerializer.java   View Source Code Vote up 5 votes
@Override
public void saveElements(Pager.Page page, ElementSource source, List<Object> elements, Bundle state) {
    ArrayList<String> list = new ArrayList<>();
    for (Object element : elements) {
        if (element instanceof String) {
            list.add((String) element);
        }
    }
    if (!list.isEmpty()) {
        state.putStringArrayList("page:"+page.getPageNumber(), list);
    }
}
 
Example 16
Project: QuestionnaireView   File: QuestionPagerAdapter.java   View Source Code Vote up 5 votes
@Override
public Fragment getItem(int position) {
    fragment = new QuestionFragment();
    Bundle args = new Bundle();
    args.putInt(POSITION_KEY, position);
    if(questions == null || questions.isEmpty())
        return fragment;
    else if(questions.get(position) == null ) return fragment;
    args.putString(QUESTION_KEY, questions.get(position).getContent());
    args.putStringArrayList(ANSWERS_KEY, questions.get(position).getAnswers());
    args.putInt(ANSWER_TYPE_KEY, questions.get(position).getAnswer_type());
    fragment.setArguments(args);
    return fragment;
}
 
Example 17
Project: LaunchEnr   File: AsyncLoadContactPhones.java   View Source Code Vote up 4 votes
@Override
protected void onPostExecute(Void result) {

    if (phonesList.size() > 1) {

        Bundle bundle = new Bundle();

        FragmentManager fm = activity.getFragmentManager();

        bundle.putStringArrayList("contactPhones", phonesList);

        ContactsNumberDialog dialogFragment = new ContactsNumberDialog();

        dialogFragment.setArguments(bundle);

        dialogFragment.show(fm, "callMe");

    } else {

        CallUtil.performCall(activity, phonesList.get(0));
    }
}
 
Example 18
Project: MRouter   File: MainActivity.java   View Source Code Vote up 4 votes
public Bundle assembleBundle() {
    User user = new User();
    user.setAge(90);
    user.setGender(1);
    user.setName("kitty");

    Address address = new Address();
    address.setCity("HangZhou");
    address.setProvince("ZheJiang");

    Bundle extras = new Bundle();
    extras.putString("extra", "from extras");


    ArrayList<String> stringList = new ArrayList<>();
    stringList.add("Java");
    stringList.add("C#");
    stringList.add("Kotlin");

    ArrayList<String> stringArrayList = new ArrayList<>();
    stringArrayList.add("American");
    stringArrayList.add("China");
    stringArrayList.add("England");

    ArrayList<Integer> intArrayList = new ArrayList<>();
    intArrayList.add(100);
    intArrayList.add(101);
    intArrayList.add(102);

    ArrayList<Integer> intList = new ArrayList<>();
    intList.add(10011);
    intList.add(10111);
    intList.add(10211);

    ArrayList<Address> addressList = new ArrayList<>();
    addressList.add(new Address("JiangXi", "ShangRao", null));
    addressList.add(new Address("ZheJiang", "NingBo", null));

    Address[] addressArray = new Address[]{
            new Address("Beijing", "Beijing", null),
            new Address("Shanghai", "Shanghai", null),
            new Address("Guangzhou", "Guangzhou", null)
    };
    Bundle bundle = new Bundle();
    bundle.putSerializable("user", user);
    bundle.putParcelable("address", address);
    bundle.putParcelableArrayList("addressList", addressList);
    bundle.putParcelableArray("addressArray", addressArray);
    bundle.putString("param", "chiclaim");
    bundle.putStringArray("stringArray", new String[]{"a", "b", "c"});
    bundle.putStringArrayList("stringArrayList", stringList);
    bundle.putStringArrayList("stringList", stringArrayList);
    bundle.putByte("byte", (byte) 2);
    bundle.putByteArray("byteArray", new byte[]{1, 2, 3, 4, 5});
    bundle.putInt("age", 33);
    bundle.putIntArray("intArray", new int[]{10, 11, 12, 13});
    bundle.putIntegerArrayList("intList", intList);
    bundle.putIntegerArrayList("intArrayList", intArrayList);
    bundle.putChar("chara", 'c');
    bundle.putCharArray("charArray", "chiclaim".toCharArray());
    bundle.putShort("short", (short) 1000000);
    bundle.putShortArray("shortArray", new short[]{(short) 10.9, (short) 11.9});
    bundle.putDouble("double", 1200000);
    bundle.putDoubleArray("doubleArray", new double[]{1232, 9999, 8789, 3.1415926});
    bundle.putLong("long", 999999999);
    bundle.putLongArray("longArray", new long[]{1000, 2000, 3000});
    bundle.putFloat("float", 333);
    bundle.putFloatArray("floatArray", new float[]{12.9f, 234.9f});
    bundle.putBoolean("boolean", true);
    bundle.putBooleanArray("booleanArray", new boolean[]{true, false, true});

    return bundle;
}
 
Example 19
Project: Pocket-Plays-for-Twitch   File: Utils.java   View Source Code Vote up 4 votes
/**
 * Builds and returns a {@link Bundle} which contains a select subset of data in the
 * {@link MediaInfo}. Since {@link MediaInfo} is not {@link Parcelable}, one can use this
 * container bundle to pass around from one activity to another.
 *
 * @see <code>bundleToMediaInfo()</code>
 */
public static Bundle mediaInfoToBundle(MediaInfo info) {
    if (info == null) {
        return null;
    }

    MediaMetadata md = info.getMetadata();
    Bundle wrapper = new Bundle();
    wrapper.putString(MediaMetadata.KEY_TITLE, md.getString(MediaMetadata.KEY_TITLE));
    wrapper.putString(MediaMetadata.KEY_SUBTITLE, md.getString(MediaMetadata.KEY_SUBTITLE));
    wrapper.putString(MediaMetadata.KEY_ALBUM_TITLE,
            md.getString(MediaMetadata.KEY_ALBUM_TITLE));
    wrapper.putString(MediaMetadata.KEY_ALBUM_ARTIST,
            md.getString(MediaMetadata.KEY_ALBUM_ARTIST));
    wrapper.putString(MediaMetadata.KEY_COMPOSER, md.getString(MediaMetadata.KEY_COMPOSER));
    wrapper.putString(MediaMetadata.KEY_SERIES_TITLE,
            md.getString(MediaMetadata.KEY_SERIES_TITLE));
    wrapper.putInt(MediaMetadata.KEY_SEASON_NUMBER,
            md.getInt(MediaMetadata.KEY_SEASON_NUMBER));
    wrapper.putInt(MediaMetadata.KEY_EPISODE_NUMBER,
            md.getInt(MediaMetadata.KEY_EPISODE_NUMBER));
    Calendar releaseCalendar = md.getDate(MediaMetadata.KEY_RELEASE_DATE);
    if (releaseCalendar != null) {
        long releaseMillis = releaseCalendar.getTimeInMillis();
        wrapper.putLong(MediaMetadata.KEY_RELEASE_DATE, releaseMillis);
    }
    wrapper.putInt(KEY_MEDIA_TYPE, info.getMetadata().getMediaType());
    wrapper.putString(KEY_URL, info.getContentId());
    wrapper.putString(MediaMetadata.KEY_STUDIO, md.getString(MediaMetadata.KEY_STUDIO));
    wrapper.putString(KEY_CONTENT_TYPE, info.getContentType());
    wrapper.putInt(KEY_STREAM_TYPE, info.getStreamType());
    wrapper.putLong(KEY_STREAM_DURATION, info.getStreamDuration());
    if (!md.getImages().isEmpty()) {
        ArrayList<String> urls = new ArrayList<>();
        for (WebImage img : md.getImages()) {
            urls.add(img.getUrl().toString());
        }
        wrapper.putStringArrayList(KEY_IMAGES, urls);
    }
    JSONObject customData = info.getCustomData();
    if (customData != null) {
        wrapper.putString(KEY_CUSTOM_DATA, customData.toString());
    }
    if (info.getMediaTracks() != null && !info.getMediaTracks().isEmpty()) {
        try {
            JSONArray jsonArray = new JSONArray();
            for (MediaTrack mt : info.getMediaTracks()) {
                JSONObject jsonObject = new JSONObject();
                jsonObject.put(KEY_TRACK_NAME, mt.getName());
                jsonObject.put(KEY_TRACK_CONTENT_ID, mt.getContentId());
                jsonObject.put(KEY_TRACK_ID, mt.getId());
                jsonObject.put(KEY_TRACK_LANGUAGE, mt.getLanguage());
                jsonObject.put(KEY_TRACK_TYPE, mt.getType());
                jsonObject.put(KEY_TRACK_CONTENT_TYPE, mt.getContentType());
                if (mt.getSubtype() != MediaTrack.SUBTYPE_UNKNOWN) {
                    jsonObject.put(KEY_TRACK_SUBTYPE, mt.getSubtype());
                }
                if (mt.getCustomData() != null) {
                    jsonObject.put(KEY_TRACK_CUSTOM_DATA, mt.getCustomData().toString());
                }
                jsonArray.put(jsonObject);
            }
            wrapper.putString(KEY_TRACKS_DATA, jsonArray.toString());
        } catch (JSONException e) {
            LOGE(TAG, "mediaInfoToBundle(): Failed to convert Tracks data to json", e);
        }
    }

    return wrapper;
}
 
Example 20
Project: TaBeTa   File: ClaSSePA.java   View Source Code Vote up 4 votes
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);
            }
        }
    }

    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(),
            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;
}