List of usage examples for android.content Intent putParcelableArrayListExtra
public @NonNull Intent putParcelableArrayListExtra(String name, ArrayList<? extends Parcelable> value)
From source file:com.wit.android.support.content.intent.ShareIntent.java
/** *///from w w w . j av a 2 s. c o m @Nullable @Override public Intent buildIntent() { if (TextUtils.isEmpty(mDataType)) { Log.e(TAG, "Can not to create SHARE intent. Missing MIME type."); return null; } final Intent intent = new Intent(Intent.ACTION_SEND); intent.setType(mDataType); if (!TextUtils.isEmpty(mTitle)) { intent.putExtra(Intent.EXTRA_TITLE, mTitle); } if (!TextUtils.isEmpty(mContent)) { intent.putExtra(Intent.EXTRA_TEXT, mContent); } if (mUri != null) { intent.putExtra(Intent.EXTRA_STREAM, mUri); } else if (mUris != null) { intent.setAction(Intent.ACTION_SEND_MULTIPLE); intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, mUris); } return intent; }
From source file:com.xbm.android.matisse.ui.MatisseActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode != RESULT_OK) return;/*from w w w .j a v a 2s . co m*/ if (requestCode == REQUEST_CODE_PREVIEW) { Bundle resultBundle = data.getBundleExtra(BasePreviewActivity.EXTRA_RESULT_BUNDLE); ArrayList<Item> selected = resultBundle.getParcelableArrayList(SelectedItemCollection.STATE_SELECTION); int collectionType = resultBundle.getInt(SelectedItemCollection.STATE_COLLECTION_TYPE, SelectedItemCollection.COLLECTION_UNDEFINED); if (data.getBooleanExtra(BasePreviewActivity.EXTRA_RESULT_APPLY, false)) { Intent result = new Intent(); ArrayList<Uri> selectedUris = new ArrayList<>(); ArrayList<String> selectedPaths = new ArrayList<>(); if (selected != null) { for (Item item : selected) { selectedUris.add(item.getContentUri()); selectedPaths.add(PathUtils.getPath(this, item.getContentUri())); } } result.putParcelableArrayListExtra(EXTRA_RESULT_SELECTION, selectedUris); result.putStringArrayListExtra(EXTRA_RESULT_SELECTION_PATH, selectedPaths); setResult(RESULT_OK, result); finish(); } else { mSelectedCollection.overwrite(selected, collectionType); Fragment mediaSelectionFragment = getSupportFragmentManager() .findFragmentByTag(MediaSelectionFragment.class.getSimpleName()); if (mediaSelectionFragment instanceof MediaSelectionFragment) { ((MediaSelectionFragment) mediaSelectionFragment).refreshMediaGrid(); } updateBottomToolbar(); } } else if (requestCode == REQUEST_CODE_CAPTURE) { // Just pass the data back to previous calling Activity. Uri contentUri = mMediaStoreCompat.getCurrentPhotoUri(); String path = mMediaStoreCompat.getCurrentPhotoPath(); ArrayList<Uri> selected = new ArrayList<>(); selected.add(contentUri); ArrayList<String> selectedPath = new ArrayList<>(); selectedPath.add(path); Intent result = new Intent(); result.putParcelableArrayListExtra(EXTRA_RESULT_SELECTION, selected); result.putStringArrayListExtra(EXTRA_RESULT_SELECTION_PATH, selectedPath); setResult(RESULT_OK, result); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) MatisseActivity.this.revokeUriPermission(contentUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); finish(); } }
From source file:com.jlcsoftware.callrecorder.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { Intent intent = new Intent(this, SettingsActivity.class); startActivity(intent);//from w w w .j ava 2 s. c o m return true; } if (id == R.id.action_save) { if (null != selectedItems && selectedItems.length > 0) { Runnable runnable = new Runnable() { @Override public void run() { for (PhoneCallRecord record : selectedItems) { record.getPhoneCall().setKept(true); record.getPhoneCall().save(MainActivity.this); } LocalBroadcastManager.getInstance(MainActivity.this) .sendBroadcast(new Intent(LocalBroadcastActions.NEW_RECORDING_BROADCAST)); // Causes refresh } }; handler.post(runnable); } return true; } if (id == R.id.action_share) { if (null != selectedItems && selectedItems.length > 0) { Runnable runnable = new Runnable() { @Override public void run() { ArrayList<Uri> fileUris = new ArrayList<Uri>(); for (PhoneCallRecord record : selectedItems) { fileUris.add(Uri.fromFile(new File(record.getPhoneCall().getPathToRecording()))); } Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND_MULTIPLE); shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, fileUris); shareIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.email_title)); shareIntent.putExtra(Intent.EXTRA_HTML_TEXT, Html.fromHtml(getString(R.string.email_body_html))); shareIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.email_body)); shareIntent.setType("audio/*"); startActivity(Intent.createChooser(shareIntent, getString(R.string.action_share))); } }; handler.post(runnable); } return true; } if (id == R.id.action_delete) { if (null != selectedItems && selectedItems.length > 0) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(R.string.delete_recording_title); alert.setMessage(R.string.delete_recording_subject); alert.setPositiveButton(R.string.dialog_yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Runnable runnable = new Runnable() { @Override public void run() { Database callLog = Database.getInstance(MainActivity.this); for (PhoneCallRecord record : selectedItems) { int id = record.getPhoneCall().getId(); callLog.removeCall(id); } LocalBroadcastManager.getInstance(MainActivity.this).sendBroadcast( new Intent(LocalBroadcastActions.RECORDING_DELETED_BROADCAST)); } }; handler.post(runnable); dialog.dismiss(); } }); alert.setNegativeButton(R.string.dialog_no, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alert.show(); } return true; } if (id == R.id.action_delete_all) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(R.string.delete_recording_title); alert.setMessage(R.string.delete_all_recording_subject); alert.setPositiveButton(R.string.dialog_yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Runnable runnable = new Runnable() { @Override public void run() { Database.getInstance(MainActivity.this).removeAllCalls(false); LocalBroadcastManager.getInstance(getApplicationContext()) .sendBroadcast(new Intent(LocalBroadcastActions.RECORDING_DELETED_BROADCAST)); } }; handler.post(runnable); dialog.dismiss(); } }); alert.setNegativeButton(R.string.dialog_no, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alert.show(); return true; } if (R.id.action_whitelist == id) { if (permissionReadContacts) { Intent intent = new Intent(this, WhitelistActivity.class); startActivity(intent); } else { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(R.string.permission_whitelist_title); alert.setMessage(R.string.permission_whitelist); } return true; } if (R.id.action_about == id) { AboutDialog.show(this); return true; } return super.onOptionsItemSelected(item); }
From source file:net.sf.diningout.app.ui.InitActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.done: if (mPager != null && mPager.getCurrentItem() == 0) { // continue to friends slideToItem(1);/* w ww . j ava 2s . com*/ } else { // add restaurants, follow and invite friends, send to restaurants Activity Intent intent = new Intent(this, InitService.class); /* send selected restaurants */ Place[] places = ((InitRestaurantsFragment) findFragmentByPane(1)).getChecked(); if (places != null) { ArrayList<ContentValues> vals = new ArrayList<>(places.length); for (Place place : places) { vals.add(Restaurants.values(place)); } intent.putParcelableArrayListExtra(EXTRA_RESTAURANTS, vals); } /* send followed friends */ FriendsFragment friends = findFragmentByPane(2); long[] followed = friends.getFollowed(); startService(intent.putExtra(EXTRA_FOLLOW_IDS, followed)); Prefs.putBoolean(this, APP, ONBOARDED, true); startActivity(new Intent(this, RestaurantsActivity.class)); friends.invite(); finish(); // last so invite returns to restaurants event("restaurants", "init", places != null ? places.length : 0L); event("friends", "init", followed != null ? followed.length : 0L); } return true; default: return super.onOptionsItemSelected(item); } }
From source file:pl.mrwojtek.sensrec.app.Records.java
public boolean shareActivated() { ArrayList<Uri> files = new ArrayList<>(); for (RecordEntry recordEntry : records) { if (recordEntry.isActivated()) { files.add(Uri.fromFile(recordEntry.getFile())); }//from w ww . ja v a 2 s. c o m } Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND_MULTIPLE); intent.setType("application/octet-stream"); intent.putExtra(Intent.EXTRA_SUBJECT, "Sensors Record recordings."); intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, files); if (intent.resolveActivity(getActivity().getPackageManager()) != null) { getActivity().startActivity(intent); return true; } else { return false; } }
From source file:com.wikonos.fingerprint.activities.MainActivity.java
/** * Create dialog list of logs/*from www . j ava2 s . c o m*/ * * @return */ public AlertDialog getDialogReviewLogs() { /** * List of logs */ File folder = new File(LogWriter.APPEND_PATH); final String[] files = folder.list(new FilenameFilter() { public boolean accept(File dir, String filename) { if (filename.contains(".log") && !filename.equals(LogWriter.DEFAULT_NAME) && !filename.equals(LogWriterSensors.DEFAULT_NAME) && !filename.equals(ErrorLog.DEFAULT_NAME)) return true; else return false; } }); Arrays.sort(files); ArrayUtils.reverse(files); String[] files_with_status = new String[files.length]; String[] sent_mode = { "", "(s) ", "(e) ", "(s+e) " }; for (int i = 0; i < files.length; ++i) { //0 -- not sent //1 -- server //2 -- email files_with_status[i] = sent_mode[getSentFlags(files[i], this)] + files[i]; } if (files != null && files.length > 0) { final boolean[] selected = new boolean[files.length]; final AlertDialog ald = new AlertDialog.Builder(MainActivity.this) .setMultiChoiceItems(files_with_status, selected, new DialogInterface.OnMultiChoiceClickListener() { public void onClick(DialogInterface dialog, int which, boolean isChecked) { selected[which] = isChecked; } }) .setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { // removeDialog(DIALOG_ID_REVIEW); } }) /** * Delete log */ .setNegativeButton("Delete", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { //Show delete confirm standardConfirmDialog("Delete Logs", "Are you sure you want to delete selected logs?", new OnClickListener() { //Confrim Delete @Override public void onClick(DialogInterface dialog, int which) { int deleteCount = 0; boolean flagSelected = false; for (int i = 0; i < selected.length; i++) { if (selected[i]) { flagSelected = true; LogWriter.delete(files[i]); LogWriter.delete(files[i].replace(".log", ".dev")); deleteCount++; } } reviewLogsCheckItems(flagSelected); removeDialog(DIALOG_ID_REVIEW); Toast.makeText(getApplicationContext(), deleteCount + " logs deleted.", Toast.LENGTH_SHORT).show(); } }, new OnClickListener() { //Cancel Delete @Override public void onClick(DialogInterface dialog, int which) { //Do nothing dialog.dismiss(); Toast.makeText(getApplicationContext(), "Delete cancelled.", Toast.LENGTH_SHORT).show(); } }, false); } }) /** * Send to server functional **/ .setNeutralButton("Send to Server", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (isOnline()) { ArrayList<String> filesList = new ArrayList<String>(); for (int i = 0; i < selected.length; i++) if (selected[i]) { filesList.add(LogWriter.APPEND_PATH + files[i]); //Move to httplogsender //setSentFlags(files[i], 1, MainActivity.this); //Mark file as sent } if (reviewLogsCheckItems(filesList.size() > 0 ? true : false)) { DataPersistence d = new DataPersistence(getApplicationContext()); new HttpLogSender(MainActivity.this, d.getServerName() + getString(R.string.submit_log_url), filesList) .setToken(getToken()).execute(); } // removeDialog(DIALOG_ID_REVIEW); } else { standardAlertDialog(getString(R.string.msg_alert), getString(R.string.msg_no_internet), null); } } }) /** * Email **/ .setPositiveButton("eMail", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { boolean flagSelected = false; // convert from paths to Android friendly // Parcelable Uri's ArrayList<Uri> uris = new ArrayList<Uri>(); for (int i = 0; i < selected.length; i++) if (selected[i]) { flagSelected = true; /** wifi **/ File fileIn = new File(LogWriter.APPEND_PATH + files[i]); Uri u = Uri.fromFile(fileIn); uris.add(u); /** sensors **/ File fileInSensors = new File( LogWriter.APPEND_PATH + files[i].replace(".log", ".dev")); Uri uSens = Uri.fromFile(fileInSensors); uris.add(uSens); setSentFlags(files[i], 2, MainActivity.this); //Mark file as emailed } if (reviewLogsCheckItems(flagSelected)) { /** * Run sending email activity */ Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE); emailIntent.setType("plain/text"); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Wifi Searcher Scan Log"); emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); startActivity(Intent.createChooser(emailIntent, "Send mail...")); } // removeDialog(DIALOG_ID_REVIEW); } }).create(); ald.getListView().setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, final int position, long id) { AlertDialog segmentNameAlert = segmentNameDailog("Rename Segment", ald.getContext(), files[position], null, view, files, position); segmentNameAlert.setCanceledOnTouchOutside(false); segmentNameAlert.show(); return false; } }); return ald; } else { return standardAlertDialog(getString(R.string.msg_alert), getString(R.string.msg_log_nocount), new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { removeDialog(DIALOG_ID_REVIEW); } }); } }
From source file:com.ymt.demo1.plates.hub.FireHubMainFragment.java
protected void initView(View view) { //??/* ww w .j a v a 2 s. co m*/ ExpandableListView expandableListView = (ExpandableListView) view.findViewById(R.id.hub_list_view); //? ProgressBar progressBar = new ProgressBar(getActivity()); progressBar.setIndeterminate(true); expandableListView.setEmptyView(progressBar); hubPlateAdapter = new HubPlateAdapter(getActivity()); expandableListView.setAdapter(hubPlateAdapter); //item expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { @Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { //??? Intent intent = new Intent(getActivity(), SubjectsActivity.class); intent.putExtra("plate", childList.get(groupPosition).get(childPosition)); intent.putExtra("group_name", parentList.get(groupPosition).getName()); startActivity(intent); getActivity().overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right); return true; } }); ImageView doPostView = (ImageView) view.findViewById(R.id.hub_act_post); // ImageView topPostView = (ImageView) view.findViewById(R.id.hub_act_top); ImageView newPostView = (ImageView) view.findViewById(R.id.hub_act_new); ImageView hotPostView = (ImageView) view.findViewById(R.id.hub_act_hot); ImageView myPostView = (ImageView) view.findViewById(R.id.hub_act_my); View.OnClickListener onClickListener = new View.OnClickListener() { @Override public void onClick(View v) { switch (v.getId()) { case R.id.hub_act_post: //? Intent intent1 = new Intent(getActivity(), DoPostActivity.class); ArrayList<HubPlate> parents = new ArrayList<>(); for (HubPlate plate : parentList) { parents.add(plate); } ArrayList<HubPlate> childs = new ArrayList<>(); for (List<HubPlate> pList : childList) { for (HubPlate plate : pList) { childs.add(plate); } } intent1.putParcelableArrayListExtra("parent", parents); intent1.putParcelableArrayListExtra("child", childs); getActivity().startActivity(intent1); getActivity().overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right); break; // case R.id.hub_act_top: //?? // // break; case R.id.hub_act_new: //? Intent intentN = new Intent(getActivity(), HotNewPostActivity.class); intentN.putExtra("type", HotNewPostActivity.TYPE_NEW); startActivity(intentN); getActivity().overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right); break; case R.id.hub_act_hot: //? Intent intentH = new Intent(getActivity(), HotNewPostActivity.class); intentH.putExtra("type", HotNewPostActivity.TYPE_HOT); startActivity(intentH); getActivity().overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right); break; case R.id.hub_act_my: //? startActivity(new Intent(getActivity(), MyHubTabActivity.class)); getActivity().overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right); break; } } }; doPostView.setOnClickListener(onClickListener); // topPostView.setOnClickListener(onClickListener); newPostView.setOnClickListener(onClickListener); hotPostView.setOnClickListener(onClickListener); myPostView.setOnClickListener(onClickListener); }
From source file:it.uniroma3.android.gpstracklogger.adapters.AdapterTrack.java
private void sendMail(int position) { Track track = Session.getController().getImportedTracks().get(position); final Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("*/*"); intent.setAction(Intent.ACTION_SEND_MULTIPLE); intent.putExtra(Intent.EXTRA_SUBJECT, "Traccia: " + track.getName()); ArrayList<Uri> chosenFile = new ArrayList<>(); String path = track.getPath(); File file = new File(path); Uri uri = null;/*from ww w . j a va 2 s . co m*/ if (path.contains(AppSettings.getDirectory())) uri = FileProvider.getUriForFile(activity, "it.uniroma3.android.gpstracklogger.GPSMainActivity", file); else uri = Uri.fromFile(file); chosenFile.add(uri); intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, chosenFile); activity.startActivity(Intent.createChooser(intent, "Condividi via...")); }
From source file:org.alfresco.mobile.android.application.fragments.actions.NodeActions.java
private void startReview() { Intent it = new Intent(PrivateIntent.ACTION_START_PROCESS, null, getActivity(), PrivateDialogActivity.class); ArrayList<Node> docs = new ArrayList<>(selectedItems.size()); for (Node node : selectedItems) { docs.add(new NodePlaceHolder(node.getIdentifier(), node.getName())); }//from w ww.j a va 2s .c om it.putParcelableArrayListExtra(PrivateIntent.EXTRA_DOCUMENTS, docs); getActivity().startActivity(it); }
From source file:fr.cph.chicago.activity.MainActivity.java
@Override public void startActivity(Intent intent) { // check if search intent if (Intent.ACTION_SEARCH.equals(intent.getAction())) { ArrayList<BikeStation> bikeStations = getIntent().getExtras().getParcelableArrayList("bikeStations"); intent.putParcelableArrayListExtra("bikeStations", bikeStations); }/*ww w .j av a 2 s.c o m*/ super.startActivity(intent); }