List of usage examples for android.content Intent putParcelableArrayListExtra
public @NonNull Intent putParcelableArrayListExtra(String name, ArrayList<? extends Parcelable> value)
From source file:com.securecomcode.text.ContactSelectionActivity.java
private void handleSelectionFinished() { List<ContactData> contacts = contactsFragment.getSelectedContacts(); contacts.addAll(recentFragment.getSelectedContacts()); contacts.addAll(groupsFragment.getSelectedContacts(this)); Intent resultIntent = getIntent(); resultIntent.putParcelableArrayListExtra("contacts", new ArrayList<ContactData>(contacts)); setResult(RESULT_OK, resultIntent);/*from w w w . j a v a 2 s. c o m*/ finish(); }
From source file:me.fireant.photoselect.ui.PhotoPreviewActivity.java
private void onBack() { Intent intent = new Intent(); intent.putParcelableArrayListExtra(BUNDLE_SELECTED_PHOTOS, mSelectedPhotos); setResult(RESULT_OK, intent);//from w ww . j av a 2 s.com }
From source file:com.groupme.sdk.activity.GroupCreateActivity.java
public void onLaunchContactSelector(View view) { Intent intent = new Intent(this, AddContactActivity.class); intent.putParcelableArrayListExtra("selected_contacts", mContacts); startActivityForResult(intent, AddContactActivity.REQUEST_CONTACTS_SELECT); }
From source file:org.mozilla.mozstumbler.service.stumblerthread.scanners.WifiScanner.java
private void reportScanResults(ArrayList<ScanResult> scanResults) { if (scanResults.isEmpty()) { return;/* w ww .j av a 2 s . co m*/ } Intent i = new Intent(ACTION_WIFIS_SCANNED); i.putParcelableArrayListExtra(ACTION_WIFIS_SCANNED_ARG_RESULTS, scanResults); i.putExtra(ACTION_WIFIS_SCANNED_ARG_TIME, System.currentTimeMillis()); LocalBroadcastManager.getInstance(mAppContext).sendBroadcastSync(i); }
From source file:com.germainz.identiconizer.services.IdenticonCreationService.java
private void createNotificationForError() { Intent intent = new Intent(this, ErrorsListActivity.class); intent.putParcelableArrayListExtra("insertErrors", mInsertErrors); intent.putParcelableArrayListExtra("updateErrors", mUpdateErrors); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); String contentText = getString(R.string.sql_error_notification_text, mInsertErrors.size() + mUpdateErrors.size()); Notification notice = new NotificationCompat.Builder(this).setSmallIcon(R.drawable.ic_settings_identicons) .setContentTitle(getString(R.string.sql_error_notification_title)).setContentText(contentText) .setContentIntent(contentIntent) .setStyle(new NotificationCompat.BigTextStyle().bigText(contentText)).setAutoCancel(true).build(); NotificationManager nm = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); nm.notify(ERROR_NOTIFICATION_ID, notice); }
From source file:com.example.propertylist.MainActivity.java
private void startListActivity() { Intent intent = new Intent(MainActivity.this, PropertyListActivity.class); intent.putParcelableArrayListExtra("PROPERTY", (ArrayList<? extends Parcelable>) propertyList); intent.putExtra("LARGESCREEN", largeScreen); startActivity(intent);//from ww w . j a va2s . c o m }
From source file:com.google.samples.apps.friendlyping.gcm.MyGcmListenerService.java
private void digestData(Bundle data) throws JSONException { final String action = data.getString("action"); Log.d(TAG, "Action: " + action); if (action == null) { Log.w(TAG, "onMessageReceived: Action was null, skipping further processing."); return;/*from www .java2s. c o m*/ } Intent broadcastIntent = new Intent(action); switch (action) { case GcmAction.SEND_CLIENT_LIST: final ArrayList<Pinger> pingers = getPingers(data); broadcastIntent.putParcelableArrayListExtra(IntentExtras.PINGERS, pingers); break; case GcmAction.BROADCAST_NEW_CLIENT: Pinger newPinger = getNewPinger(data); broadcastIntent.putExtra(IntentExtras.NEW_PINGER, newPinger); break; case GcmAction.PING_CLIENT: Ping newPing = getNewPing(data); broadcastIntent.putExtra(IntentExtras.NEW_PING, newPing); break; } LocalBroadcastManager.getInstance(this).sendBroadcast(broadcastIntent); }
From source file:com.visva.voicerecorder.utils.Utils.java
public static void shareMultiFileByShareActionMode(Context context, ArrayList<RecordingSession> selectedList) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND_MULTIPLE); intent.putExtra(Intent.EXTRA_SUBJECT, "Here are some files."); intent.setType("image/jpeg"); /* This example is sharing jpeg images. */ ArrayList<Uri> files = new ArrayList<Uri>(); for (RecordingSession recordingSession : selectedList /* List of the files you want to send */) { File file = new File(recordingSession.fileName); Uri uri = Uri.fromFile(file);//from ww w.j a v a 2 s. com files.add(uri); } intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, files); context.startActivity(intent); }
From source file:com.example.topnewgrid.choosephotos.choosephotos.photoviewer.photoviewerinterface.ViewPagerActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_view_pager); mViewPager = (HackyViewPager) findViewById(R.id.view_pager); files = this.getIntent().getParcelableArrayListExtra(FILES); this.index = this.getIntent().getIntExtra(CURRENT_INDEX, 0); /**??**///w w w .j a v a 2 s . c o m for (int i = 0; i < files.size(); i++) { if (files.get(i).isSelect()) { chooseNum++; } } tv = (TextView) findViewById(R.id.photo_album_chooseNum); tv.setText("" + chooseNum + ""); Button btnBack = (Button) findViewById(R.id.btnBack); btnBack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent data = new Intent(); data.putParcelableArrayListExtra(FILES, files); setResult(VIEW_PAGER_CODE, data); ViewPagerActivity.this.finish(); } }); btnCheck = (Button) findViewById(R.id.btnCheck); btnCheck.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int position = mViewPager.getCurrentItem(); boolean isSelect = files.get(position).isSelect(); files.get(position).setSelect(!isSelect); if (isSelect) { chooseNum--; btnCheck.setBackgroundResource(R.drawable.image_unselected_icon); } else { chooseNum++; btnCheck.setBackgroundResource(R.drawable.image_selected_icon); } tv.setText("" + chooseNum + ""); } }); boolean isSelect = files.get(mViewPager.getCurrentItem()).isSelect(); if (isSelect) { btnCheck.setBackgroundResource(R.drawable.image_selected_icon); } else { btnCheck.setBackgroundResource(R.drawable.image_unselected_icon); } mViewPager.setAdapter(new SamplePagerAdapter()); mViewPager.setCurrentItem(index); mViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int position) { boolean isSelect = files.get(position).isSelect(); if (isSelect) { btnCheck.setBackgroundResource(R.drawable.image_selected_icon); } else { btnCheck.setBackgroundResource(R.drawable.image_unselected_icon); } } @Override public void onPageScrolled(int position, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int state) { } }); //? Button btnFinish = (Button) findViewById(R.id.btnFinish); btnFinish.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent data = new Intent(); data.putParcelableArrayListExtra(FILES, files); setResult(VIEW_PAGER_CODE, data); ViewPagerActivity.this.finish(); } }); }
From source file:com.theelix.libreexplorer.ActionModeCallback.java
@Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { SparseBooleanArray checkedArray = listView.getCheckedItemPositions(); final List<File> selectedFiles = new ArrayList<>(); final ArrayList<Uri> selectedUris = new ArrayList<>(); for (int i = 0; i < listView.getCount(); i++) { if (checkedArray.get(i)) { selectedFiles.add((File) listView.getItemAtPosition(i)); selectedUris.add(android.net.Uri.fromFile((File) listView.getItemAtPosition(i))); }/*from w ww.j a v a 2 s . co m*/ } switch (item.getItemId()) { case R.id.toolbar_menu_copy: FileManager.prepareCopy(selectedFiles.toArray(new File[selectedFiles.size()])); break; case R.id.toolbar_menu_cut: FileManager.prepareCut(selectedFiles.toArray(new File[selectedFiles.size()])); break; case R.id.toolbar_menu_delete: AlertDialog.Builder builder = new AlertDialog.Builder(mContext); if (selectedFiles.size() > 1) { builder.setMessage(mContext.getString(R.string.delete_dialog_multiple) + " " + selectedFiles.size() + " " + mContext.getString(R.string.delete_dialog_items) + "?"); } else builder.setMessage(mContext.getString(R.string.delete_dialog_single)); builder.setPositiveButton(mContext.getString(R.string.dialog_ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { DeleteTask task = new DeleteTask(mContext, selectedFiles.toArray(new File[selectedFiles.size()])); task.execute(); } }); builder.setNegativeButton(mContext.getString(R.string.dialog_cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); builder.show(); break; case R.id.toolbar_menu_rename: DialogFragment renameDialog = new RenameDialog(); ((RenameDialog) renameDialog).setSelectedFiles(selectedFiles.toArray()); renameDialog.show(((FileManagerActivity) mContext).getSupportFragmentManager(), "rename_dialog"); break; case R.id.toolbar_menu_details: DialogFragment detailsDialog = new DetailsDialog(); ((DetailsDialog) detailsDialog).setTargetFile(selectedFiles.get(0)); detailsDialog.show(((FileManagerActivity) mContext).getSupportFragmentManager(), "details_dialog"); break; case R.id.toolbar_menu_share: Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND_MULTIPLE); shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, selectedUris); shareIntent.setType("*/*"); mContext.startActivity(Intent.createChooser(shareIntent, "Share to...")); break; } mode.finish(); return true; }