List of usage examples for android.content Intent putParcelableArrayListExtra
public @NonNull Intent putParcelableArrayListExtra(String name, ArrayList<? extends Parcelable> value)
From source file:org.intermine.app.activity.TemplateResultsActivity.java
public static void start(Context context, String templateName, String templateTitle, String mineName, ArrayList<TemplateParameter> params) { Intent intent = new Intent(context, TemplateResultsActivity.class); intent.putExtra(TEMPLATE_NAME_KEY, templateName); intent.putExtra(TEMPLATE_TITLE_KEY, templateTitle); intent.putExtra(MINE_NAME_KEY, mineName); intent.putParcelableArrayListExtra(TEMPLATE_PARAMS_KEY, params); context.startActivity(intent);//w w w. ja va 2 s .c om }
From source file:at.jclehner.appopsxposed.BugReportBuilder.java
public static void buildAndSend(final Context context) { if (!SU.available()) { Toast.makeText(context, R.string.toast_needs_root, Toast.LENGTH_SHORT).show(); return;//from ww w. j a va 2 s.co m } Toast.makeText(context, R.string.building_toast, Toast.LENGTH_LONG).show(); final BugReportBuilder brb = new BugReportBuilder(context); new AsyncTask<Void, Void, Uri>() { @Override protected Uri doInBackground(Void... params) { return brb.build(); } @Override protected void onPostExecute(Uri result) { final ArrayList<Parcelable> uris = new ArrayList<Parcelable>(); uris.add(result); final Intent target = new Intent(Intent.ACTION_SEND_MULTIPLE); target.setType("text/plain"); target.putExtra(Intent.EXTRA_SUBJECT, "[REPORT][AppOpsXposed " + Util.getAoxVersion(context) + "] " + Build.FINGERPRINT); target.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); //target.putExtra(Intent.EXTRA_STREAM, result); target.putExtra(Intent.EXTRA_TEXT, "!!! BUG REPORTS WITHOUT ADDITIONAL INFO WILL BE IGNORED !!!"); //target.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); final Intent intent = Intent.createChooser(target, null); //intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); context.startActivity(intent); } }.execute(); }
From source file:Main.java
public static Intent newSendMultipleAttachmentsIntent(String emailAddress, String subject, String contentBody, ArrayList<Uri> uris) { final Intent ei = new Intent(Intent.ACTION_SEND_MULTIPLE); ei.setType("plain/text"); ei.putExtra(Intent.EXTRA_EMAIL, new String[] { emailAddress }); ei.putExtra(Intent.EXTRA_SUBJECT, subject); //ei.putExtra(Intent.EXTRA_TEXT, contentBody); //fix for ClassCastException with Intent.EXTRA_TEXT : https://code.google.com/p/android/issues/detail?id=38303 //: use list of string not a string ArrayList<String> extra_text = new ArrayList<String>(); extra_text.add(contentBody);/* ww w . j a v a 2s. c om*/ ei.putExtra(Intent.EXTRA_TEXT, extra_text); ei.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); return ei; }
From source file:com.codetroopers.shakemytours.ui.activity.TripActivity.java
public static Intent newIntent(Context context, ArrayList<Travel> selectedTravels) { Intent intent = new Intent(context, TripActivity.class); intent.putParcelableArrayListExtra(PARAM_TRAVELS, selectedTravels); return intent; }
From source file:org.linphone.compatibility.ApiElevenPlus.java
public static Intent prepareEditContactIntentWithSipAddress(int id, String sipUri) { Intent intent = new Intent(Intent.ACTION_EDIT, Contacts.CONTENT_URI); Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, id); intent.setData(contactUri);/*from ww w. j ava 2 s. c o m*/ ArrayList<ContentValues> data = new ArrayList<ContentValues>(); ContentValues sipAddressRow = new ContentValues(); sipAddressRow.put(Contacts.Data.MIMETYPE, SipAddress.CONTENT_ITEM_TYPE); sipAddressRow.put(SipAddress.SIP_ADDRESS, sipUri); data.add(sipAddressRow); intent.putParcelableArrayListExtra(Insert.DATA, data); return intent; }
From source file:com.android.shell.BugreportReceiver.java
/** * Build {@link Intent} that can be used to share the given bugreport. *//* ww w . j a va 2 s.co m*/ private static Intent buildSendIntent(Context context, Uri bugreportUri, Uri screenshotUri) { final Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setType("application/vnd.android.bugreport"); intent.putExtra(Intent.EXTRA_SUBJECT, bugreportUri.getLastPathSegment()); intent.putExtra(Intent.EXTRA_TEXT, SystemProperties.get("ro.build.description")); final ArrayList<Uri> attachments = Lists.newArrayList(bugreportUri, screenshotUri); intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, attachments); final Account sendToAccount = findSendToAccount(context); if (sendToAccount != null) { intent.putExtra(Intent.EXTRA_EMAIL, new String[] { sendToAccount.name }); } return intent; }
From source file:org.linphone.compatibility.ApiElevenPlus.java
public static Intent prepareAddContactIntent(String displayName, String sipUri) { Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI); intent.putExtra(Insert.NAME, displayName); if (sipUri != null && sipUri.startsWith("sip:")) { sipUri = sipUri.substring(4);/*from w ww . java 2 s . c o m*/ } ArrayList<ContentValues> data = new ArrayList<ContentValues>(); ContentValues sipAddressRow = new ContentValues(); sipAddressRow.put(Contacts.Data.MIMETYPE, SipAddress.CONTENT_ITEM_TYPE); sipAddressRow.put(SipAddress.SIP_ADDRESS, sipUri); data.add(sipAddressRow); intent.putParcelableArrayListExtra(Insert.DATA, data); return intent; }
From source file:org.alfresco.mobile.android.application.manager.ActionManager.java
public static void actionSendDocuments(Fragment fr, List<File> files) { if (files.size() == 1) { actionSendDocument(fr, files.get(0)); return;//from w w w .j av a2 s. c om } try { Intent i = new Intent(Intent.ACTION_SEND_MULTIPLE); ArrayList<Uri> uris = new ArrayList<Uri>(); // convert from paths to Android friendly Parcelable Uri's for (File file : files) { Uri u = Uri.fromFile(file); uris.add(u); } i.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); i.setType(MimeTypeManager.getMIMEType(fr.getActivity(), "text/plain")); fr.getActivity() .startActivity(Intent.createChooser(i, fr.getActivity().getText(R.string.share_content))); } catch (ActivityNotFoundException e) { MessengerManager.showToast(fr.getActivity(), R.string.error_unable_share_content); } }
From source file:com.nuvolect.securesuite.data.ExportVcf.java
public static void emailVcf(Activity act, long contact_id) { String messageTitle = "vCard for "; String messageBody = "\n\n\nContact from SecureSuite, a secure contact manager"; try {/*w w w. ja v a 2 s . c o m*/ String displayName = SqlCipher.get(contact_id, ATab.display_name); String fileName = displayName.replaceAll("\\W+", ""); if (fileName.isEmpty()) fileName = "contact"; fileName = fileName + ".vcf"; new File(act.getFilesDir() + CConst.SHARE_FOLDER).mkdirs(); File vcf_file = new File(act.getFilesDir() + CConst.SHARE_FOLDER + fileName); writeContactVcard(contact_id, vcf_file); // Must match "authorities" in Manifest provider definition String authorities = act.getResources().getString(R.string.app_authorities) + ".provider"; Uri uri = null; try { uri = FileProvider.getUriForFile(act, authorities, vcf_file); } catch (IllegalArgumentException e) { LogUtil.logException(act, LogType.EXPORT_VCF, e); } //convert from paths to Android friendly Parcelable Uri's ArrayList<Uri> uris = new ArrayList<Uri>(); uris.add(uri); Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, messageTitle + displayName); intent.putExtra(Intent.EXTRA_TEXT, messageBody); intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.putExtra("path", vcf_file.getAbsolutePath()); intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); act.startActivityForResult(Intent.createChooser(intent, "Share with..."), CConst.RESPONSE_CODE_SHARE_VCF); } catch (Exception e) { LogUtil.logException(act, LogType.EXPORT_VCF, e); } }
From source file:org.alfresco.mobile.android.application.manager.ActionManager.java
public static void actionSendDocumentsToAlfresco(Fragment fr, List<File> files) { if (files.size() == 1) { actionSendDocumentToAlfresco(fr.getActivity(), files.get(0)); return;// w w w . ja v a 2s .c o m } try { Intent i = new Intent(fr.getActivity(), PublicDispatcherActivity.class); i.setAction(Intent.ACTION_SEND_MULTIPLE); ArrayList<Uri> uris = new ArrayList<Uri>(); // convert from paths to Android friendly Parcelable Uri's for (File file : files) { Uri u = Uri.fromFile(file); uris.add(u); } i.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); i.setType(MimeTypeManager.getMIMEType(fr.getActivity(), "text/plain")); fr.getActivity().startActivity(i); } catch (ActivityNotFoundException e) { MessengerManager.showToast(fr.getActivity(), R.string.error_unable_share_content); } }