0
A
回答
1
Android不提供外的現成意圖用於選擇多個圖像/圖片,或任何其他媒體類型。資料來源:https://stackoverflow.com/a/12919585/450534(我通常會把馬克墨菲的話當作福音,除非有人可以挑戰它)
最接近的意圖是ACTION_SEND_MULTIPLE.
那。但是,不適合你。
您將需要創建一個自定義選擇器類似於Facebook自己的移動應用程序。
你會得到一個完整的運行例子在這裏實現自己的多重圖像選擇:http://vikaskanani.wordpress.com/2011/07/20/android-custom-image-gallery-with-checkbox-in-grid-to-select-multiple/
最後,在一氣呵成多個圖像上傳到Facebook,你將需要發送Batch Requests。
但是,當然沒有現成的解決方案,您正在尋找的東西。結合上述所有內容,然後你就可以。但恐怕沒有什麼直截了當的。
0
我設法使用意圖在Facebook上分享多張照片。 變量「caminhos」是一個ArrayList < String>,其中包含要共享的圖像的路徑。
protected void share(String nameApp, String imagePath, String text) {
// TODO Auto-generated method stub
try {
List<Intent> targetedShareIntents = new ArrayList<Intent>();
Intent share = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
share.setType("image/jpeg");
List<ResolveInfo> resInfo = getActivity().getPackageManager()
.queryIntentActivities(share, 0);
if (!resInfo.isEmpty()) {
for (ResolveInfo info : resInfo) {
Intent targetedShare = new Intent(
android.content.Intent.ACTION_SEND_MULTIPLE);
targetedShare.setType("image/png"); // put here your mime
// type
if (info.activityInfo.packageName.toLowerCase().contains(
nameApp)
|| info.activityInfo.name.toLowerCase().contains(
nameApp)) {
targetedShare.putExtra(Intent.EXTRA_SUBJECT, text);
targetedShare.putExtra(Intent.EXTRA_TEXT, text);
ArrayList<Uri> files = new ArrayList<Uri>();
for(int j= 0;j<caminhos.size();j++){
if(!caminhos.get(j).isEmpty()){
File file = new File(caminhos.get(j));
Uri uri = Uri.fromFile(file);
files.add(uri);
}
}
targetedShare.putParcelableArrayListExtra(Intent.EXTRA_STREAM,
files);
targetedShare.setPackage(info.activityInfo.packageName);
targetedShareIntents.add(targetedShare);
}
}
Intent chooserIntent = Intent.createChooser(
targetedShareIntents.remove(0), "Select app to share");
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS,
targetedShareIntents.toArray(new Parcelable[] {}));
startActivity(chooserIntent);
}
} catch (Exception e) {
}
}
相關問題
- 1. 在臉書上分享圖片
- 2. 在Windows Phone 7上傳一張照片到臉書
- 3. 上傳的照片張貼到臉書專輯
- 4. 如何與臉書和推特分享照片?
- 5. 在臉書上分享Facebook上的圖片ID
- 6. 在臉書上分享HTML內容
- 7. 從Google照片上傳多張照片
- 8. 在Facebook上分享照片?
- 9. 使用FBConnect在臉書上分享圖片
- 10. 上傳多張照片
- 11. 上傳多張照片
- 12. 在Facebook上上傳多張照片
- 13. 分享臉書的描述
- 14. 上傳和分享照片
- 15. 在臉書上的照片上製作倍數標籤
- 16. UiImagePickerController - 多張照片
- 17. 與HWIOAuthBundle獲取臉書照片
- 18. 卡在張貼到臉書
- 19. 上傳Facebook上的多張照片
- 20. 有時無法上傳照片在臉書3.0?
- 21. 在點擊(臉書式的)表單上顯示照片
- 22. 如何在臉書照片上標記人物?
- 23. 在牆上張貼照片
- 24. MFMailComposeViewController:附加照片(多張照片)
- 25. 如何在臉書分享個人產品圖片
- 26. 如何在Google+上分享照片?
- 27. iPhone在Facebook上分享照片
- 28. 在Facebook上分享照片Android SDK
- 29. og:鏈接共享時,圖片未顯示在臉書上
- 30. 在臉書上的頁面上分享視頻
的可能重複的[意圖+分享+行動\ _Send \ _Multiple + Facebook的不工作(http://stackoverflow.com/questions/25846496/intent-share-action-send-多Facebook的 - 不工作) – bummi