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.android.settings.localepicker.LocaleDragAndDropAdapter.java

/**
 * Saves the list of checked locales to preserve status when the list is destroyed.
 * (for instance when the device is rotated)
 * @param outInstanceState Bundle in which to place the saved state
 *///from  w  ww.  j  av  a  2s .c om
public void saveState(Bundle outInstanceState) {
    if (outInstanceState != null) {
        final ArrayList<String> selectedLocales = new ArrayList<>();
        for (LocaleStore.LocaleInfo li : mFeedItemList) {
            if (li.getChecked()) {
                selectedLocales.add(li.getId());
            }
        }
        outInstanceState.putStringArrayList(CFGKEY_SELECTED_LOCALES, selectedLocales);
    }
}

From source file:th.in.ffc.app.form.EditFormActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putStringArrayList("edit", mEditList);
    outState.putStringArrayList("delete", mDeleteList);
}

From source file:org.anhonesteffort.flock.SubscriptionGoogleFragment.java

private void handleLoadSkuList(final String productType) {
    if (asyncTask != null)
        return;/*from  ww w.j  a  va2 s .  co  m*/

    asyncTask = new AsyncTask<Void, Void, Bundle>() {

        @Override
        protected void onPreExecute() {
            Log.d(TAG, "handleLoadSkuList");
            subscriptionActivity.setProgressBarIndeterminateVisibility(true);
            subscriptionActivity.setProgressBarVisibility(true);
        }

        private ArrayList<String> getSkuDetails(ArrayList<String> skuList, Bundle result)
                throws RemoteException {
            Bundle skuBundle = new Bundle();
            skuBundle.putStringArrayList("ITEM_ID_LIST", skuList);

            Bundle skuDetails = subscriptionActivity.billingService.getSkuDetails(3,
                    SubscriptionGoogleFragment.class.getPackage().getName(), productType, skuBundle);

            if (skuDetails.getInt("RESPONSE_CODE") == 0)
                return skuDetails.getStringArrayList("DETAILS_LIST");
            else {
                Log.e(TAG, "sku details response code is != 0");
                result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_GOOGLE_PLAY_ERROR);
                return new ArrayList<String>(0);
            }
        }

        @Override
        protected Bundle doInBackground(Void... params) {
            Bundle result = new Bundle();

            if (subscriptionActivity.billingService == null) {
                Log.e(TAG, "billing service is null");
                result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_GOOGLE_PLAY_ERROR);
                return result;
            }

            ArrayList<String> skuQueryList = new ArrayList<String>(2);
            skuQueryList.add(SKU_YEARLY_SUBSCRIPTION);

            try {

                List<String> skuDetails = getSkuDetails(skuQueryList, result);
                ArrayList<String> skuList = new ArrayList<String>();

                if (result.getInt(ErrorToaster.KEY_STATUS_CODE, -1) != -1)
                    return result;

                for (String thisResponse : skuDetails) {
                    JSONObject productObject = new JSONObject(thisResponse);
                    skuList.add(productObject.getString("productId"));
                }

                result.putStringArrayList("SKU_LIST", skuList);
                result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_SUCCESS);

            } catch (JSONException e) {
                Log.e(TAG, "error parsing sku details", e);
                result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_GOOGLE_PLAY_ERROR);
            } catch (RemoteException e) {
                Log.e(TAG, "error parsing sku details", e);
                result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_GOOGLE_PLAY_ERROR);
            }

            return result;
        }

        @Override
        protected void onPostExecute(Bundle result) {
            asyncTask = null;
            subscriptionActivity.setProgressBarIndeterminateVisibility(false);
            subscriptionActivity.setProgressBarVisibility(false);

            if (result.getInt(ErrorToaster.KEY_STATUS_CODE) == ErrorToaster.CODE_SUCCESS)
                handleSkuListLoaded(result.getStringArrayList("SKU_LIST"));
            else
                ErrorToaster.handleDisplayToastBundledError(subscriptionActivity, result);
        }
    }.execute();
}

From source file:com.mohamnag.inappbilling.InAppBillingPlugin.java

/**
 * Loads products with specific IDs and gets their details.
 *
 * @param productIds/*from  www. j  a v  a 2s .  c o  m*/
 * @param callbackContext
 */
private void loadProductDetails(final ArrayList<String> productIds, final CallbackContext callbackContext)
        throws JSONException {

    jsLog("loadProductDetails called.");

    if (productIds == null || productIds.isEmpty()) {
        jsLog("Product list was empty");
        callbackContext.success(myInventory.getAllProductsJSON());
    } else {
        jsLog("Loading/refreshing product details");

        Bundle querySkus = new Bundle();
        querySkus.putStringArrayList("ITEM_ID_LIST", productIds);

        // do same query with both types to load all!
        Error errInapp = querySkuDetails(querySkus, BILLING_ITEM_TYPE_INAPP);
        Error errSubs = querySkuDetails(querySkus, BILLING_ITEM_TYPE_SUBS);

        // only call success if no error has happened
        if (errInapp != null) {
            callbackContext.error(errInapp.toJavaScriptJSON());
        } else if (errSubs != null) {
            callbackContext.error(errSubs.toJavaScriptJSON());
        } else {
            callbackContext.success(myInventory.getAllProductsJSON());
        }

    }
}

From source file:com.hippo.scene.StageActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putInt(KEY_STAGE_ID, mStageId);
    outState.putStringArrayList(KEY_SCENE_TAG_LIST, mSceneTagList);
    outState.putInt(KEY_NEXT_ID, mIdGenerator.getAndIncrement());
}

From source file:org.thialfihar.android.apg.ui.CertifyKeyActivity.java

/**
 * kicks off the actual signing process on a background thread
 *///  w w  w  .  ja  v a2s. c  o  m
private void startSigning() {

    // Bail out if there is not at least one user id selected
    ArrayList<String> userIds = mUserIdsAdapter.getSelectedUserIds();
    if (userIds.isEmpty()) {
        Toast.makeText(CertifyKeyActivity.this, "No User IDs to sign selected!", Toast.LENGTH_SHORT).show();
        return;
    }

    // Send all information needed to service to sign key in other thread
    Intent intent = new Intent(this, ApgIntentService.class);

    intent.setAction(ApgIntentService.ACTION_CERTIFY_KEYRING);

    // fill values for this action
    Bundle data = new Bundle();

    data.putLong(ApgIntentService.CERTIFY_KEY_MASTER_KEY_ID, mMasterKeyId);
    data.putLong(ApgIntentService.CERTIFY_KEY_PUB_KEY_ID, mPubKeyId);
    data.putLong(ApgIntentService.CERTIFY_KEY_PUB_KEY_ID, mPubKeyId);
    data.putStringArrayList(ApgIntentService.CERTIFY_KEY_UIDS, userIds);

    intent.putExtra(ApgIntentService.EXTRA_DATA, data);

    // Message is received after signing is done in ApgService
    ApgIntentServiceHandler saveHandler = new ApgIntentServiceHandler(this,
            getString(R.string.progress_signing), ProgressDialog.STYLE_SPINNER) {
        public void handleMessage(Message message) {
            // handle messages by standard ApgHandler first
            super.handleMessage(message);

            if (message.arg1 == ApgIntentServiceHandler.MESSAGE_OKAY) {

                Toast.makeText(CertifyKeyActivity.this, R.string.key_sign_success, Toast.LENGTH_SHORT).show();

                // check if we need to send the key to the server or not
                if (mUploadKeyCheckbox.isChecked()) {
                    // upload the newly signed key to the keyserver
                    uploadKey();
                } else {
                    setResult(RESULT_OK);
                    finish();
                }
            }
        }
    };

    // Create a new Messenger for the communication back
    Messenger messenger = new Messenger(saveHandler);
    intent.putExtra(ApgIntentService.EXTRA_MESSENGER, messenger);

    // show progress dialog
    saveHandler.showProgressDialog(this);

    // start service with intent
    startService(intent);
}

From source file:com.google.samples.drive.trash.MainActivity.java

@Override
protected void onSaveInstanceState(Bundle savedInstanceState) {
    super.onSaveInstanceState(savedInstanceState);
    ArrayList<String> driveIds = new ArrayList<>();
    while (!mPreviousFolders.isEmpty()) {
        driveIds.add(mPreviousFolders.pop().encodeToString());
    }/* w w w.j av  a 2  s.  c om*/
    savedInstanceState.putStringArrayList("previousFolders", driveIds);
    // Check here required since login pop up causes onSaveInstanceState to be called.
    if (mCurrentFolder != null) {
        savedInstanceState.putString("currentFolder", mCurrentFolder.encodeToString());
    }
}

From source file:com.nicolls.ablum.activity.HomeFragmentActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_home_media_chooser);

    pathList = getIntent().getStringArrayListExtra("pathList");
    if (pathList == null) {
        pathList = new ArrayList<>();
    }/*from ww  w. jav  a  2s. c o  m*/
    //      Toast.makeText(this,pathList.size()+"-@@@--",Toast.LENGTH_SHORT).show();

    headerBarTitle = (TextView) findViewById(R.id.titleTextViewFromMediaChooserHeaderBar);
    headerBarCamera = (ImageView) findViewById(R.id.cameraImageViewFromMediaChooserHeaderBar);
    headerBarBack = (ImageView) findViewById(R.id.backArrowImageViewFromMediaChooserHeaderView);
    headerBarDone = (TextView) findViewById(R.id.doneTextViewViewFromMediaChooserHeaderView);
    mTabHost = (FragmentTabHost) findViewById(android.R.id.tabhost);

    mTabHost.setup(this, getSupportFragmentManager(), R.id.realTabcontent);
    headerBarBack.setOnClickListener(clickListener);
    headerBarCamera.setOnClickListener(clickListener);
    headerBarDone.setOnClickListener(clickListener);

    headerBarCamera.setVisibility(View.GONE);

    if (getIntent() != null && (getIntent().getBooleanExtra("isFromBucket", false))) {

        if (getIntent().getBooleanExtra("image", false)) {
            headerBarTitle.setText(getResources().getString(R.string.image));
            setHeaderBarCameraBackground(getResources().getDrawable(R.drawable.selector_camera_button));

            headerBarCamera.setTag(getResources().getString(R.string.image));

            Bundle bundle = new Bundle();
            bundle.putString("name", getIntent().getStringExtra("name"));
            bundle.putStringArrayList("pathList", pathList);
            //            Toast.makeText(this,pathList.size()+"!!!!",Toast.LENGTH_SHORT).show();

            mTabHost.addTab(
                    mTabHost.newTabSpec("tab1")
                            .setIndicator(getResources().getString(R.string.images_tab) + "     "),
                    ImageFragment.class, bundle);

        } else {
            headerBarTitle.setText(getResources().getString(R.string.video));
            setHeaderBarCameraBackground(getResources().getDrawable(R.drawable.selector_video_button));
            headerBarCamera.setTag(getResources().getString(R.string.video));

            Bundle bundle = new Bundle();
            bundle.putStringArrayList("pathList", pathList);
            //            Toast.makeText(this,pathList.size()+"!!!",Toast.LENGTH_SHORT).show();

            bundle.putString("name", getIntent().getStringExtra("name"));
            mTabHost.addTab(
                    mTabHost.newTabSpec("tab2")
                            .setIndicator(getResources().getString(R.string.videos_tab) + "      "),
                    VideoFragment.class, bundle);
        }
    } else {

        if (MediaChooserConstants.showVideo) {
            mTabHost.addTab(
                    mTabHost.newTabSpec("tab2")
                            .setIndicator(getResources().getString(R.string.videos_tab) + "      "),
                    VideoFragment.class, null);
        }

        if (MediaChooserConstants.showImage) {
            headerBarTitle.setText(getResources().getString(R.string.image));
            setHeaderBarCameraBackground(getResources().getDrawable(R.drawable.selector_camera_button));
            headerBarCamera.setTag(getResources().getString(R.string.image));

            mTabHost.addTab(
                    mTabHost.newTabSpec("tab1")
                            .setIndicator(getResources().getString(R.string.images_tab) + "      "),
                    ImageFragment.class, null);
        }

        if (MediaChooserConstants.showVideo) {
            headerBarTitle.setText(getResources().getString(R.string.video));
            setHeaderBarCameraBackground(getResources().getDrawable(R.drawable.selector_video_button));
            headerBarCamera.setTag(getResources().getString(R.string.video));
        }
    }

    for (int i = 0; i < mTabHost.getTabWidget().getChildCount(); i++) {

        TextView textView = (TextView) mTabHost.getTabWidget().getChildAt(i).findViewById(android.R.id.title);
        if (textView.getLayoutParams() instanceof RelativeLayout.LayoutParams) {

            RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) textView.getLayoutParams();
            params.addRule(RelativeLayout.CENTER_HORIZONTAL);
            params.addRule(RelativeLayout.CENTER_VERTICAL);
            params.height = RelativeLayout.LayoutParams.MATCH_PARENT;
            params.width = RelativeLayout.LayoutParams.WRAP_CONTENT;
            textView.setLayoutParams(params);

        } else if (textView.getLayoutParams() instanceof LinearLayout.LayoutParams) {
            LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) textView.getLayoutParams();
            params.gravity = Gravity.CENTER;
            textView.setLayoutParams(params);
        }
        textView.setTextColor(getResources().getColor(R.color.tabs_title_color));
        textView.setTextSize(convertDipToPixels(10));

    }

    if ((mTabHost.getTabWidget().getChildAt(0) != null)) {
        ((TextView) (mTabHost.getTabWidget().getChildAt(0).findViewById(android.R.id.title)))
                .setTextColor(Color.WHITE);
    }

    if ((mTabHost.getTabWidget().getChildAt(1) != null)) {
        ((TextView) (mTabHost.getTabWidget().getChildAt(1).findViewById(android.R.id.title)))
                .setTextColor(getResources().getColor(R.color.headerbar_selected_tab_color));
    }

    mTabHost.setOnTabChangedListener(new OnTabChangeListener() {

        @Override
        public void onTabChanged(String tabId) {

            android.support.v4.app.FragmentManager fragmentManager = getSupportFragmentManager();
            ImageFragment imageFragment = (ImageFragment) fragmentManager.findFragmentByTag("tab1");
            VideoFragment videoFragment = (VideoFragment) fragmentManager.findFragmentByTag("tab2");
            android.support.v4.app.FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();

            if (tabId.equalsIgnoreCase("tab1")) {

                headerBarTitle.setText(getResources().getString(R.string.image));
                setHeaderBarCameraBackground(getResources().getDrawable(R.drawable.selector_camera_button));
                headerBarCamera.setTag(getResources().getString(R.string.image));

                if (imageFragment != null) {

                    if (videoFragment != null) {
                        fragmentTransaction.hide(videoFragment);
                    }
                    fragmentTransaction.show(imageFragment);
                }
                ((TextView) (mTabHost.getTabWidget().getChildAt(0).findViewById(android.R.id.title)))
                        .setTextColor(getResources().getColor(R.color.headerbar_selected_tab_color));
                ((TextView) (mTabHost.getTabWidget().getChildAt(1).findViewById(android.R.id.title)))
                        .setTextColor(Color.WHITE);

            } else {
                headerBarTitle.setText(getResources().getString(R.string.video));
                setHeaderBarCameraBackground(getResources().getDrawable(R.drawable.selector_video_button));
                headerBarCamera.setTag(getResources().getString(R.string.video));

                if (videoFragment != null) {

                    if (imageFragment != null) {
                        fragmentTransaction.hide(imageFragment);
                    }

                    fragmentTransaction.show(videoFragment);
                    if (videoFragment.getAdapter() != null) {
                        videoFragment.getAdapter().notifyDataSetChanged();
                    }
                }
                ((TextView) (mTabHost.getTabWidget().getChildAt(0).findViewById(android.R.id.title)))
                        .setTextColor(Color.WHITE);
                ((TextView) (mTabHost.getTabWidget().getChildAt(1).findViewById(android.R.id.title)))
                        .setTextColor(getResources().getColor(R.color.headerbar_selected_tab_color));
            }

            fragmentTransaction.commit();
        }
    });

    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) headerBarCamera.getLayoutParams();
    params.height = convertDipToPixels(40);
    params.width = convertDipToPixels(40);
    headerBarCamera.setLayoutParams(params);
    headerBarCamera.setScaleType(ScaleType.CENTER_INSIDE);
    headerBarCamera.setPadding(convertDipToPixels(15), convertDipToPixels(15), convertDipToPixels(15),
            convertDipToPixels(15));

}

From source file:com.open.file.manager.MainActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    ArrayList<String> oldfrags = mAdapter.getFragments();
    outState.putStringArrayList("fragments", oldfrags);
    outState.putInt("operation", FileOperations.currentaction);
    if (FileOperations.currentpath != null) {
        outState.putString("currentpath", FileOperations.currentpath);
    }/*from  w  ww  .j  a  v  a  2  s  .c  o  m*/
    if (FileOperations.conflicts != null && FileOperations.conflicts.size() > 0) {
        outState.putParcelableArrayList("conflicts", FileOperations.conflicts);
    }
    if (!FileOperations.operationqueue.isEmpty()) {
        ArrayList<String> oldoperations = new ArrayList<String>();
        for (File current : FileOperations.operationqueue) {
            oldoperations.add(current.getAbsolutePath());
        }
        outState.putStringArrayList("oldqueue", oldoperations);
    }
    ArrayList<String> oldselected = new ArrayList<String>();
    for (File current : selectedfiles) {
        oldselected.add(current.getAbsolutePath());
    }
    outState.putStringArrayList("selectedfiles", oldselected);
}

From source file:com.yahala.ui.GroupCreateActivity.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.group_create_menu, menu);
    SupportMenuItem doneItem = (SupportMenuItem) menu.findItem(R.id.done_menu_item);
    TextView doneTextView = (TextView) doneItem.getActionView().findViewById(R.id.done_button);
    doneTextView.setText(LocaleController.getString("Next", R.string.Next));
    doneTextView.setOnClickListener(new View.OnClickListener() {
        @Override/*ww  w.  j ava 2 s. c  o m*/
        public void onClick(View view) {

            if (!selectedContacts.isEmpty()) {
                ArrayList<String> result = new ArrayList<String>();
                result.addAll(selectedContacts.keySet());
                Bundle args = new Bundle();
                args.putStringArrayList("result", result);
                FileLog.e("selectedContacts.size()", selectedContacts.size() + "");
                GroupCreateFinalActivity groupCreateFinalActivity = new GroupCreateFinalActivity();
                groupCreateFinalActivity.setArguments(args);
                ((LaunchActivity) parentActivity).presentFragment(groupCreateFinalActivity,
                        "group_create_final", false);

            } else {
                return;
            }

        }
    });
}