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.awesomeapp.messenger.ui.ContactsPickerActivity.java

private void multiFinish(SparseBooleanArray positions) {

    ArrayList<String> users = new ArrayList<String>();
    ArrayList<Integer> providers = new ArrayList<Integer>();
    ArrayList<Integer> accounts = new ArrayList<Integer>();

    for (int i = 0; i < positions.size(); i++) {
        if (positions.valueAt(i)) {
            Cursor cursor = (Cursor) mAdapter.getItem(i);

            users.add(cursor.getString(ContactListItem.COLUMN_CONTACT_USERNAME));
            providers.add((int) cursor.getLong(ContactListItem.COLUMN_CONTACT_PROVIDER));
            accounts.add((int) cursor.getLong(ContactListItem.COLUMN_CONTACT_ACCOUNT));
        }/*from   w w  w .  ja v  a  2 s .c om*/
    }

    Intent data = new Intent();
    data.putStringArrayListExtra(EXTRA_RESULT_USERNAMES, users);
    data.putIntegerArrayListExtra(EXTRA_RESULT_PROVIDER, providers);
    data.putIntegerArrayListExtra(EXTRA_RESULT_ACCOUNT, accounts);
    setResult(RESULT_OK, data);
    finish();
}

From source file:eu.codeplumbers.cosi.activities.CozyActivity.java

@Override
public void onDownloadFolder(File file) {
    if (currentFragment instanceof FileManagerFragment) {
        List<File> filesInFolder = File.getAllFileInFolderRecursive(file);
        File[] array = filesInFolder.toArray(new File[filesInFolder.size()]);

        ArrayList<String> arrayList = new ArrayList<>();

        for (int i = 0; i < array.length; i++) {
            arrayList.add(i, array[i].getId() + "");
        }//from www. j  a v a 2s .com

        Intent intent = new Intent(CozyActivity.this, CosiFileDownloadService.class);
        intent.putStringArrayListExtra("fileToDownload", arrayList);

        startService(intent);
    }
}

From source file:semanticweb.hws14.movapp.activities.MovieDetail.java

public void toActorList(View view) {
    Intent intent = new Intent(that, ActorList.class);
    intent.putStringArrayListExtra("actorList", movieDet.getActors());
    startActivity(intent);//www .j  a  va 2 s  .  c o m
}

From source file:com.doplgangr.secrecy.views.VaultsListFragment.java

void restore() {
    ArrayList<String> INCLUDE_EXTENSIONS_LIST = new ArrayList<String>();
    INCLUDE_EXTENSIONS_LIST.add(".zip");

    Intent intent = new Intent(context, FileChooserActivity.class);

    intent.putStringArrayListExtra(FileChooserActivity.EXTRA_FILTER_INCLUDE_EXTENSIONS,
            INCLUDE_EXTENSIONS_LIST);/*from w ww . j av a2  s. com*/
    intent.putExtra(FileChooserActivity.PATH, Storage.getRoot().getAbsolutePath());
    startActivityForResult(intent, REQUESTCODE);
}

From source file:com.github.akinaru.bleanalyzer.bluetooth.BluetoothCustomManager.java

/**
 * broadcast characteristic value/*from w ww  . j  ava2  s.c om*/
 *
 * @param action action to be sent (data available)
 */
@Override
public void broadcastUpdateStringList(String action, ArrayList<String> valueList) {

    String valueName = "";
    final Intent intent = new Intent(action);
    intent.putStringArrayListExtra(valueName, valueList);
    context.sendBroadcast(intent);
}

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

public void broadcastTaskList(ArrayList<String> ids, ArrayList<String> titles) {
    Intent intent = new Intent();
    intent.setAction(ACTION_LIST_TASKS);
    intent.putStringArrayListExtra("ids", ids);
    intent.putStringArrayListExtra("titles", titles);
    intent.putExtra("done", true);
    sendBroadcast(intent);/*from w w w . j a  va 2  s.  c o m*/
}

From source file:org.wso2.emm.agent.services.operation.OperationManagerWorkProfile.java

@Override
public void restrictAccessToApplications(Operation operation) throws AndroidAgentException {
    AppRestriction appRestriction = CommonUtils.getAppRestrictionTypeAndList(operation, getResultBuilder(),
            getContextResources());//from   w  w w .  ja va 2  s  .  c  o  m

    if (Constants.AppRestriction.BLACK_LIST.equals(appRestriction.getRestrictionType())) {
        Intent restrictionIntent = new Intent(getContext(), AppLockService.class);
        restrictionIntent.setAction(Constants.APP_LOCK_SERVICE);

        restrictionIntent.putStringArrayListExtra(Constants.AppRestriction.APP_LIST,
                (ArrayList) appRestriction.getRestrictedList());

        PendingIntent pendingIntent = PendingIntent.getService(getContext(), 0, restrictionIntent,
                PendingIntent.FLAG_UPDATE_CURRENT);

        AlarmManager alarmManager = (AlarmManager) getContext().getSystemService(Context.ALARM_SERVICE);
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(System.currentTimeMillis());
        calendar.add(Calendar.SECOND, 1); // First time
        long frequency = 1 * 1000; // In ms
        alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), frequency,
                pendingIntent);

        getContext().startService(restrictionIntent);

    }
    operation.setStatus(getContextResources().getString(R.string.operation_value_completed));
    getResultBuilder().build(operation);
}

From source file:io.jawg.osmcontributor.ui.activities.OfflineRegionsActivity.java

private void initFloatingActionButtons() {
    deleteRegionFloatingActionButton.setOnClickListener(new View.OnClickListener() {
        @Override/*from   w  w w.  j  a  v  a2 s . co m*/
        public void onClick(View view) {
            if (selectedRegionItem != null && selectedRegionItem.getOfflineRegion() != null) {
                int position = adapter.getOfflineRegionItems().indexOf(selectedRegionItem);
                offlineRegionManager.deleteOfflineRegion(selectedRegionItem.getOfflineRegion(),
                        getOfflineRegionDeletedListener());
                adapter.removeOfflineRegion(selectedRegionItem);
                if (adapter.getItemCount() == 0) {
                    switchMode(Mode.NO_REGIONS);
                } else {
                    int newPosition = position == 0 ? 0
                            : position == adapter.getItemCount() ? adapter.getItemCount() - 1 : position - 1;
                    selectOfflineRegion(newPosition);
                }
                closeEditMenu();
            }
        }
    });

    downloadRegionFloatingActionButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (selectedRegionItem != null && selectedRegionItem.getOfflineRegion() != null) {
                Intent intent = new Intent(OfflineRegionsActivity.this, OfflineRegionDownloadService.class);
                intent.putStringArrayListExtra(OfflineRegionDownloadService.LIST_PARAM + 0,
                        convertDoubleList(selectedRegionItem.getOfflineRegion(), true));
                intent.putExtra(OfflineRegionDownloadService.SIZE_PARAM, 1);
                startService(intent);
                closeEditMenu();
            }
        }
    });

    addRegionFloatingActionButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            switchMode(Mode.ADD_REGION);
        }
    });

    downloadNewRegionFloatingActionButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (mapboxMap.getCameraPosition().zoom < MIN_DOWNLOAD_ZOOM) {
                Snackbar snackbar = Snackbar.make(activityView, R.string.region_to_large, Snackbar.LENGTH_LONG);
                TextView textView = (TextView) snackbar.getView()
                        .findViewById(android.support.design.R.id.snackbar_text);
                textView.setTextColor(ContextCompat.getColor(OfflineRegionsActivity.this, R.color.error_color));
                snackbar.show();
                return;
            }

            final Intent intent = new Intent(OfflineRegionsActivity.this, OfflineRegionDownloadService.class);

            new LovelyTextInputDialog(OfflineRegionsActivity.this).setTopColorRes(R.color.colorPrimary)
                    .setTitle(R.string.enter_region_name).setIcon(R.drawable.ic_rename)
                    .setInputFilter(R.string.region_name_error, new LovelyTextInputDialog.TextFilter() {
                        @Override
                        public boolean check(String text) {
                            return text.length() < 20;
                        }
                    }).setConfirmButton(R.string.ok, new LovelyTextInputDialog.OnTextInputConfirmListener() {
                        @Override
                        public void onTextInputConfirmed(String text) {
                            intent.putExtra(OfflineRegionDownloadService.REGION_NAME_PARAM, text);
                            LatLngBounds bounds = mapboxMap.getProjection().getVisibleRegion().latLngBounds;
                            intent.putStringArrayListExtra(OfflineRegionDownloadService.LIST_PARAM + 0,
                                    convertDoubleList(bounds, false));
                            intent.putExtra(OfflineRegionDownloadService.SIZE_PARAM, 1);
                            startService(intent);
                        }
                    }).show();
        }
    });
}

From source file:com.xbm.android.matisse.ui.MatisseActivity.java

@Override
public void onClick(View v) {
    if (v.getId() == R.id.button_preview) {
        Intent intent = new Intent(this, SelectedPreviewActivity.class);
        intent.putExtra(BasePreviewActivity.EXTRA_DEFAULT_BUNDLE, mSelectedCollection.getDataWithBundle());
        startActivityForResult(intent, REQUEST_CODE_PREVIEW);
    } else if (v.getId() == R.id.button_apply) {
        Intent result = new Intent();
        ArrayList<Uri> selectedUris = (ArrayList<Uri>) mSelectedCollection.asListOfUri();
        result.putParcelableArrayListExtra(EXTRA_RESULT_SELECTION, selectedUris);
        ArrayList<String> selectedPaths = (ArrayList<String>) mSelectedCollection.asListOfString();
        result.putStringArrayListExtra(EXTRA_RESULT_SELECTION_PATH, selectedPaths);
        setResult(RESULT_OK, result);//from   ww  w .  ja  v a  2  s .  c o m
        finish();
    }
}

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

@Override
public void onSingleImageSelected(Image image) {
    String path = image.path;/*from w ww .jav a 2 s . c  o m*/
    Intent data = new Intent();
    resultList.add(path);
    fileNames2RotationMap.put(image.path, image.rotation);

    if (desiredHeight == 0 && desiredWidth == 0 && quality == 100 && !fixRotation) {
        data.putStringArrayListExtra(EXTRA_RESULT, resultList);
        setResult(RESULT_OK, data);
        finish();
    } else {
        postProcessImages();
    }

}