本文整理汇总了Java中android.content.Intent.ACTION_SEND_MULTIPLE属性的典型用法代码示例。如果您正苦于以下问题:Java Intent.ACTION_SEND_MULTIPLE属性的具体用法?Java Intent.ACTION_SEND_MULTIPLE怎么用?Java Intent.ACTION_SEND_MULTIPLE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.content.Intent
的用法示例。
在下文中一共展示了Intent.ACTION_SEND_MULTIPLE属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onHandleIntent
@Override
protected void onHandleIntent(Intent intent) {
if (intent == null || !intent.hasExtra(Intent.EXTRA_STREAM)) {
return;
}
switch (intent.getAction()) {
case Intent.ACTION_SEND:
case Intent.ACTION_SEND_MULTIPLE:
handleSaveFile(intent);
break;
case ACTION_CLEAR_CACHE:
FileUtils.clearCache(this);
break;
}
}
示例2: share
public static void share(Context context, String album) {
ArrayList<Uri> files = new ArrayList<Uri>();
Realm realm = Realm.getDefaultInstance();
for(MediaItem item : realm.where(Album.class).equalTo("path", album).findFirst().getMedia().where().equalTo("isSelected",true).findAll()) {
File file = new File(item.getPath());
Uri uri = Uri.fromFile(file);
files.add(uri);
}
final Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
intent.setType("image/*");
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, files);
realm.beginTransaction();
realm.where(Album.class).equalTo("path", album).findFirst().clearMediaSelection();
realm.commitTransaction();
realm.close();
context.startActivity(Intent.createChooser(intent, "Share"));
}
示例3: sendLogs
private void sendLogs() {
try {
ArrayList<Uri> uris = new ArrayList<>();
File sdCard = ApplicationLoader.applicationContext.getExternalFilesDir(null);
File dir = new File(sdCard.getAbsolutePath() + "/logs");
File[] files = dir.listFiles();
for (File file : files) {
uris.add(Uri.fromFile(file));
}
if (uris.isEmpty()) {
return;
}
Intent i = new Intent(Intent.ACTION_SEND_MULTIPLE);
i.setType("message/rfc822");
i.putExtra(Intent.EXTRA_EMAIL, new String[]{BuildVars.SEND_LOGS_EMAIL});
i.putExtra(Intent.EXTRA_SUBJECT, "last logs");
i.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
getParentActivity().startActivityForResult(Intent.createChooser(i, "Select email application."), 500);
} catch (Exception e) {
e.printStackTrace();
}
}
示例4: shareMultipleFiles
public void shareMultipleFiles(List<FileItem> filesToBeShared){
ArrayList<Uri> uris = new ArrayList<>();
for(FileItem file: filesToBeShared){
uris.add(Uri.fromFile(file.getFile()));
}
final Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
intent.setType("*/*");
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
PackageManager manager = mContext.getPackageManager();
List<ResolveInfo> infos = manager.queryIntentActivities(intent, 0);
if (infos.size() > 0) {
mContext.startActivity(Intent.createChooser(intent, mContext.getString(R.string.share)));
} else {
UIUtils.ShowToast("No app found to handle sharing",mContext);
}
}
示例5: shareEvent
private void shareEvent ()
{
String title = "Phoneypot: " + mEvent.getStartTime().toLocaleString();
//need to "send multiple" to get more than one attachment
final Intent emailIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
emailIntent.setType("text/plain");
emailIntent.putExtra(Intent.EXTRA_SUBJECT, title);
emailIntent.putExtra(Intent.EXTRA_TEXT, generateLog());
//has to be an ArrayList
ArrayList<Uri> uris = new ArrayList<>();
//convert from paths to Android friendly Parcelable Uri's
for (EventTrigger trigger : mEvent.getEventTriggers())
{
File fileIn = new File(trigger.getPath());
Uri u = Uri.fromFile(fileIn);
uris.add(u);
}
emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
startActivity(Intent.createChooser(emailIntent, getString(R.string.share_event_action)));
}
示例6: ShareImagesToAssignAPP
/**
* 分享多图到指定软件,QQ,微信,新浪微博
*/
public static void ShareImagesToAssignAPP(Context context, List<File> fileList,String type) {
boolean found = false;
ArrayList<Uri> uriList = new ArrayList<>();
Intent share = new Intent(Intent.ACTION_SEND_MULTIPLE);
share.setType("image/*");
for (int i = 0; i < fileList.size(); i++) {
uriList.add(Uri.fromFile(fileList.get(i)));
}
List<ResolveInfo> resInfo = context.getPackageManager().queryIntentActivities(share, 0);
if (!resInfo.isEmpty()){
for (ResolveInfo info : resInfo) {
if (info.activityInfo.packageName.toLowerCase().contains(type) ||
info.activityInfo.name.toLowerCase().contains(type) ) {
share.setPackage(info.activityInfo.packageName);
share.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uriList);
found = true;
break;
}
}
if (!found)
return;
context.startActivity(Intent.createChooser(share, "分享到"));
}
}
示例7: sendAttachFileMail
public static void sendAttachFileMail(Context c, String[] path,
String subject, String type) {
final Intent emailIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
emailIntent.setType(type);
emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(Intent.EXTRA_TEXT, subject);
ArrayList<Uri> uris = new ArrayList<Uri>();
for (String file : path) {
File fileIn = new File(file);
Uri u = Uri.fromFile(fileIn);
uris.add(u);
}
emailIntent.putExtra(Intent.EXTRA_STREAM, uris);
try {
c.startActivity(Intent.createChooser(emailIntent, subject));
} catch (Exception e) {
Log.e(TAG, "sendAttachFileMail", e);
}
}
示例8: sendEmail
public void sendEmail(String body) {
Intent emailIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
emailIntent.setType("text/plain");
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{emailId});
emailIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.feedback_mail_subject, getAppLabel()));
emailIntent.putExtra(Intent.EXTRA_TEXT, body);
ArrayList<Uri> uris = new ArrayList<>();
if (withInfo) {
Uri deviceInfoUri = createFileFromString(deviceInfo, getString(R.string.file_name_device_info));
uris.add(deviceInfoUri);
Uri logUri = createFileFromString(LOG_TO_STRING, getString(R.string.file_name_device_log));
uris.add(logUri);
}
if (realPath != null) {
Uri uri = Uri.parse("file://" + realPath);
uris.add(uri);
}
emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
startActivity(Utils.createEmailOnlyChooserIntent(this, emailIntent, getString(R.string.send_feedback_two)));
}
示例9: emailLogIntent
public Intent emailLogIntent(Context context, String logcat) {
Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
intent.setType("application/octet-stream");
String subject = "Fit Notification Logs";
ArrayList<Uri> attachments = new ArrayList<>();
attachments.add(FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".provider", mLogFile));
intent.putExtra(Intent.EXTRA_SUBJECT, subject);
intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "[email protected]" });
intent.putExtra(Intent.EXTRA_TEXT, logcat);
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, attachments);
return intent;
}
示例10: sendLogFile
private void sendLogFile () {
Intent intent = new Intent (Intent.ACTION_SEND_MULTIPLE);
intent.setType("plain/text");
ArrayList<Uri> attachList = new ArrayList<>();
if (new File(mLogcatFile).exists())
attachList.add(Uri.parse ("file://" + mLogcatFile));
intent.putExtra (Intent.EXTRA_EMAIL, new String[] {"[email protected]"});
intent.putExtra (Intent.EXTRA_SUBJECT, "Disney Radio crash report " + getCurrentTimeStamp());
intent.putParcelableArrayListExtra (Intent.EXTRA_STREAM, attachList);
intent.putExtra (Intent.EXTRA_TEXT, "Log file attached."); // do this so some email clients don't complain about empty body.
startActivity(intent);
}