2012-08-03 99 views
1

我試圖使用ACTION_SEND_MULTIPLE意圖在同一時間共享視頻文件和文本。Android ACTION_SEND_MULTIPLE包含視頻和文本

現在,這在GMAIL(附件中的視頻和郵件正文中的文本)中起作用,但是我也想在WhatsApp中也做同樣的事情,但它不會出現在意圖應用程序的列表中。

我的代碼是下一個:

Intent sharingIntent = new Intent(Intent.ACTION_SEND_MULTIPLE); 

sharingIntent.putExtra(Intent.EXTRA_TEXT, "Descarga la app en..."); 

ArrayList<Uri> contenidos = new ArrayList<Uri>(); 

File file = new File(Environment 
    .getExternalStorageDirectory() 
    .getAbsolutePath() 
    + "/Talking/" 
    + nombreVideo 
    + ".3gp"); 

Uri screenshotUri = Uri.fromFile(file); 

contenidos.add(screenshotUri); 

//sharingIntent.putExtra(Intent.EXTRA_STREAM,screenshotUri); 
sharingIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, contenidos); 
sharingIntent.setType("video/3gpp"); 

startActivity(Intent.createChooser(sharingIntent, "Share video using")); 

感謝您的幫助。

回答

1

現在你的代碼會工作,因爲whatsapp的新更新,在此之前不接受這種意圖(ACTION_SEND_MULTIPLE),因爲它一次只接受一個文件。

Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE); 
shareIntent.setType("image/png");  
shareIntent.putExtra(android.content.Intent.EXTRA_STREAM, 
    Uri.parse("file:///mnt/sdcard/UserImages/"+ ParseUser.getCurrentUser().getObjectId() + ".png"));  
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT,"Hello test");  
startActivity(Intent.createChooser(shareIntent,"Share")); 
1

這可能意味着Whatsapp不支持這種意圖(ACTION_SEND_MULTIPLE)。

+0

這是正確的。你無法幫助它。 WhatsApp一次只選擇一個文件。 – 2012-10-29 09:42:41