Example usage for android.content Intent putStringArrayListExtra

List of usage examples for android.content Intent putStringArrayListExtra

Introduction

In this page you can find the example usage for android.content Intent putStringArrayListExtra.

Prototype

public @NonNull Intent putStringArrayListExtra(String name, ArrayList<String> value) 

Source Link

Document

Add extended data to the intent.

Usage

From source file:org.creativecommons.thelist.activities.DrawerActivity.java

@Override
public void viewImage(ArrayList<String> urls, int position) {
    //Start detailed view
    Intent intent = new Intent(DrawerActivity.this, ImageActivity.class);
    intent.putExtra("position", position);
    intent.putStringArrayListExtra("urls", urls);
    startActivity(intent);//  www. j av a2 s. c o m
}

From source file:fr.bmartel.android.tictactoe.GameSingleton.java

public void broadcastUpdateStringList(String action, ArrayList<String> valueList) {

    String valueName = "";
    final Intent intent = new Intent(action);
    intent.putStringArrayListExtra(valueName, valueList);
    context.sendBroadcast(intent);//from  w  w  w .j  av a2s. com
}

From source file:org.namelessrom.devicecontrol.modules.info.hardware.GpsView.java

public void onResume() {
    final Context context = getContext();
    final boolean location = BaseActivity.isGranted(context, Manifest.permission.ACCESS_COARSE_LOCATION)
            && BaseActivity.isGranted(context, Manifest.permission.ACCESS_FINE_LOCATION);
    if (!location) {
        final Intent intent = new Intent(BaseActivity.ACTION_REQUEST_PERMISSION);
        final ArrayList<String> permissions = new ArrayList<>(2);
        permissions.add(Manifest.permission.ACCESS_COARSE_LOCATION);
        permissions.add(Manifest.permission.ACCESS_FINE_LOCATION);
        intent.putStringArrayListExtra(BaseActivity.EXTRA_PERMISSIONS, permissions);
        LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
    }/*from  w  w w . ja  v  a  2 s. com*/

    addressSubscription = addressObservable.subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<String>() {
                @Override
                public void call(String s) {
                    if (BuildConfig.DEBUG) {
                        final Vibrator vibrator = App.get().getVibrator();
                        vibrator.cancel();
                        vibrator.vibrate(75);
                    }
                    statusView.setText(s);
                }
            }, new ErrorHandler(statusView));
}

From source file:com.cpen321.fridgemanager.OcrReader.OcrCaptureActivity.java

/**
 * onTap is called add all texts from all existing TextBlocks to databaseInteraction
 *
 * @param rawX - the raw position of the tap
 * @param rawY - the raw position of the tap.
 * @return true if the tap was on a TextBlock
 *//*from   www  .j ava2  s  . c o  m*/
private boolean onTap(float rawX, float rawY) {
    TextBlock textBlock = null;

    Set<OcrGraphic> graphics = mGraphicOverlay.getAllGraphics();

    //Create a sorted list to sort the graphics by the X and Y value of the rect of textblock
    List<OcrGraphic> sortedGraphics = new ArrayList<OcrGraphic>();

    //add the set of graphics to the arraylist
    for (OcrGraphic graphic : graphics) {
        sortedGraphics.add(graphic);
    }

    //sort the arraylist by rect coordinates of textblock of graphic
    Collections.sort(sortedGraphics, new CoordinateComparator());

    for (OcrGraphic graphic : sortedGraphics) {
        textBlock = graphic.getTextBlock();

        List<Line> lines = (List<Line>) textBlock.getComponents();
        for (int i = 0; i < lines.size(); i++) {
            texts.add(lines.get(i).getValue().replaceAll("[^a-zA-Z\r\n\\s]", ""));
            //Log.d(TAG, "line "+i+" is :" + lines.get(i).getValue().replaceAll("[^a-zA-Z\r\n\\s]", ""));
        }
    }

    Toast toast = Toast.makeText(getApplicationContext(), "Scan Complete", Toast.LENGTH_SHORT);
    toast.show();

    // starts scanResult activity
    Intent intent = new Intent(this, ScanResults.class);
    intent.putStringArrayListExtra("texts", texts);
    intent.putExtra(EXTRA_MESSAGE, message);
    startActivity(intent);

    return true;
}

From source file:com.locosoft.imageselector.MultiImageSelectorActivity.java

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

    mFakeR = new FakeR(this);
    setContentView(mFakeR.getId("layout", "activity_image_selector"));

    Intent intent = getIntent();//from   ww w  .j  a va2s .  com
    mDefaultCount = intent.getIntExtra(EXTRA_SELECT_COUNT, 9);
    int mode = intent.getIntExtra(EXTRA_SELECT_MODE, MODE_MULTI);
    boolean isShow = intent.getBooleanExtra(EXTRA_SHOW_CAMERA, true);
    if (mode == MODE_MULTI && intent.hasExtra(EXTRA_DEFAULT_SELECTED_LIST)) {
        resultList = intent.getStringArrayListExtra(EXTRA_DEFAULT_SELECTED_LIST);
    }

    desiredWidth = intent.getIntExtra(EXTRA_WIDTH, 0);
    desiredHeight = intent.getIntExtra(EXTRA_HEIGHT, 0);
    quality = intent.getIntExtra(EXTRA_QUALITY, 0);
    fixRotation = intent.getBooleanExtra(EXTRA_FIXROTATION, false);

    Bundle bundle = new Bundle();
    bundle.putInt(MultiImageSelectorFragment.EXTRA_SELECT_COUNT, mDefaultCount);
    bundle.putInt(MultiImageSelectorFragment.EXTRA_SELECT_MODE, mode);
    bundle.putBoolean(MultiImageSelectorFragment.EXTRA_SHOW_CAMERA, isShow);
    bundle.putStringArrayList(MultiImageSelectorFragment.EXTRA_DEFAULT_SELECTED_LIST, resultList);

    getSupportFragmentManager().beginTransaction().add(mFakeR.getId("id", "imageselector_image_grid"),
            Fragment.instantiate(this, MultiImageSelectorFragment.class.getName(), bundle)).commit();

    // back button
    findViewById(mFakeR.getId("id", "imageselector_btn_back")).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            setResult(RESULT_CANCELED);
            finish();
        }
    });

    // done button
    mSubmitButton = (Button) findViewById(mFakeR.getId("id", "imageselector_commit"));
    if (resultList == null || resultList.size() <= 0) {
        mSubmitButton.setText(mFakeR.getId("string", "imageselector_done"));
        mSubmitButton.setEnabled(false);
    } else {
        mSubmitButton.setText(getResources().getString(mFakeR.getId("string", "imageselector_done")) + "("
                + resultList.size() + "/" + mDefaultCount + ")");

        mSubmitButton.setEnabled(true);
    }
    mSubmitButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (resultList != null && resultList.size() > 0) {
                // return the selection array list
                if (desiredHeight == 0 && desiredWidth == 0 && quality == 100 && !fixRotation) {
                    Intent data = new Intent();
                    data.putStringArrayListExtra(EXTRA_RESULT, resultList);
                    setResult(RESULT_OK, data);
                    finish();
                } else {
                    postProcessImages();
                }
            }
        }
    });

    progress = new ProgressDialog(this);
    progress.setTitle(getResources().getString(mFakeR.getId("string", "imageselector_progress_title")));
    progress.setMessage(getResources().getString(mFakeR.getId("string", "imageselector_progress_content")));
}

From source file:net.networksaremadeofstring.rhybudd.ViewZenossDeviceListActivity.java

@Override
public void onItemSelected(ZenossDevice device, ArrayList<String> DeviceNames, ArrayList<String> DeviceIDs) {
    selectedUID = device.getuid();//from   w  w  w  . j  a v a2 s .  c  o  m
    selectedDevice = device.getname();
    //Log.e("selectedUID", selectedUID);
    if (mTwoPane) {
        // In two-pane mode, show the detail view in this activity by
        // adding or replacing the detail fragment using a
        // fragment transaction.
        Bundle arguments = new Bundle();
        arguments.putString(ViewZenossDeviceFragment.ARG_HOSTNAME, selectedDevice);
        arguments.putString(ViewZenossDeviceFragment.ARG_UID, selectedUID);
        arguments.putBoolean(ViewZenossDeviceFragment.ARG_2PANE, true);
        arguments.putStringArrayList(ViewZenossDeviceFragment.ARG_DEVICENAMES, DeviceNames);
        arguments.putStringArrayList(ViewZenossDeviceFragment.ARG_DEVICEIDS, DeviceIDs);

        ViewZenossDeviceFragment fragment = new ViewZenossDeviceFragment();
        fragment.setArguments(arguments);
        getSupportFragmentManager().beginTransaction().replace(R.id.device_detail_container, fragment).commit();
        ab.setSubtitle("Viewing " + selectedDevice);

    } else {
        // In single-pane mode, simply start the detail activity
        // for the selected item ID.
        Intent detailIntent = new Intent(this, ViewZenossDeviceActivity.class);
        detailIntent.putExtra(ViewZenossDeviceFragment.ARG_HOSTNAME, selectedDevice);
        detailIntent.putExtra(ViewZenossDeviceFragment.ARG_UID, selectedUID);
        detailIntent.putExtra(ViewZenossDeviceFragment.ARG_2PANE, false);
        detailIntent.putStringArrayListExtra(ViewZenossDeviceFragment.ARG_DEVICENAMES, DeviceNames);
        detailIntent.putStringArrayListExtra(ViewZenossDeviceFragment.ARG_DEVICEIDS, DeviceIDs);
        startActivityForResult(detailIntent, LAUNCHDETAILACTIVITY);
    }
}

From source file:com.doplgangr.secrecy.settings.SettingsFragment.java

private void preparePreferenceVaultMove() {
    Preference vault_move = findPreference("vault_move");
    vault_move.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override/*from  w  ww.  j  ava  2 s  .  c om*/
        public boolean onPreferenceClick(Preference preference) {
            choosePath(new getFileListener() {
                @Override
                public void get(File file) {
                    Intent intent = new Intent(context, FileChooserActivity.class);
                    intent.putStringArrayListExtra(FileChooserActivity.EXTRA_FILTER_INCLUDE_EXTENSIONS,
                            INCLUDE_EXTENSIONS_LIST);
                    intent.putExtra(FileChooserActivity.PATH, file.getAbsolutePath());
                    intent.putExtra(FileChooserActivity.EXTRA_SELECT_FOLDER, true);
                    startActivityForResult(intent, REQUEST_CODE_MOVE_VAULT);
                }
            });
            return true;
        }
    });
}

From source file:com.doplgangr.secrecy.settings.SettingsFragment.java

private void preparePreferenceVaultRoot() {
    Preference vault_root = findPreference("vault_root");
    vault_root.setSummary(Storage.getRoot().getAbsolutePath());
    vault_root.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override/*from  w  w  w  . jav  a2s .c  om*/
        public boolean onPreferenceClick(Preference preference) {
            choosePath(new getFileListener() {
                @Override
                public void get(File file) {
                    Intent intent = new Intent(context, FileChooserActivity.class);
                    intent.putStringArrayListExtra(FileChooserActivity.EXTRA_FILTER_INCLUDE_EXTENSIONS,
                            INCLUDE_EXTENSIONS_LIST);
                    intent.putExtra(FileChooserActivity.PATH, file.getAbsolutePath());
                    intent.putExtra(FileChooserActivity.EXTRA_SELECT_FOLDER, true);
                    startActivityForResult(intent, REQUEST_CODE_SET_VAULT_ROOT);
                }
            });
            return true;
        }
    });
}

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

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    super.onActivityResult(requestCode, resultCode, data);

    if (resultCode == Activity.RESULT_OK) {

        if (requestCode == MediaChooserConstants.BUCKET_SELECT_IMAGE_CODE) {
            addMedia(mSelectedImage, data.getStringArrayListExtra("list"));

        } else if (requestCode == MediaChooserConstants.BUCKET_SELECT_VIDEO_CODE) {
            addMedia(mSelectedVideo, data.getStringArrayListExtra("list"));

        }/*from   w  w w.  java 2  s.c o m*/
        if (mSelectedVideo.size() > 0) {
            Intent videoIntent = new Intent();
            videoIntent.setAction(MediaChooser.VIDEO_SELECTED_ACTION_FROM_MEDIA_CHOOSER);
            videoIntent.putStringArrayListExtra("list", mSelectedVideo);
            sendBroadcast(videoIntent);
        }

        if (mSelectedImage.size() > 0) {
            Intent imageIntent = new Intent();
            imageIntent.setAction(MediaChooser.IMAGE_SELECTED_ACTION_FROM_MEDIA_CHOOSER);
            imageIntent.putStringArrayListExtra("list", mSelectedImage);
            sendBroadcast(imageIntent);
        }
        finish();
        //?
        //         else if (requestCode == MediaChooserConstants.CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE){
        //
        //            sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, fileUri));
        //            final AlertDialog alertDialog = MediaChooserConstants.getDialog(BucketHomeFragmentActivity.this).create();
        //            alertDialog.show();
        //
        //            handler.postDelayed(new Runnable() {
        //               @Override
        //               public void run() {
        //                  //Do something after 2000ms
        //                  String fileUriString = fileUri.toString().replaceFirst("file:///", "/").trim();
        //                  android.support.v4.app.FragmentManager fragmentManager = getSupportFragmentManager();
        //                  BucketImageFragment bucketImageFragment = (BucketImageFragment) fragmentManager.findFragmentByTag("tab1");
        //                  if(bucketImageFragment != null){
        //                     bucketImageFragment.getAdapter().addLatestEntry(fileUriString);
        //                     bucketImageFragment.getAdapter().notifyDataSetChanged();
        //                  }
        //                  alertDialog.dismiss();
        //               }
        //            }, 5000);
        //
        //         }else if (requestCode == MediaChooserConstants.CAPTURE_VIDEO_ACTIVITY_REQUEST_CODE){
        //
        //
        //            sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, fileUri));
        //
        //            final AlertDialog alertDialog = MediaChooserConstants.getDialog(BucketHomeFragmentActivity.this).create();
        //            alertDialog.show();
        //            handler.postDelayed(new Runnable() {
        //               @Override
        //               public void run() {
        //                  //Do something after 2000ms
        //                  String fileUriString = fileUri.toString().replaceFirst("file:///", "/").trim();
        //                  android.support.v4.app.FragmentManager fragmentManager = getSupportFragmentManager();
        //                  BucketVideoFragment bucketVideoFragment = (BucketVideoFragment) fragmentManager.findFragmentByTag("tab2");
        //                  if(bucketVideoFragment != null){
        //                     bucketVideoFragment.getAdapter().addLatestEntry(fileUriString);
        //                     bucketVideoFragment.getAdapter().notifyDataSetChanged();
        //
        //                  }
        //                  alertDialog.dismiss();
        //               }
        //            }, 5000);
        //         }
    }
}