protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE_PICKER
&& resultCode == RESULT_OK && data != null) {
// Uri FilePath = data.getData();
images = data.getParcelableArrayListExtra(ImagePickerActivity.INTENT_EXTRA_SELECTED_IMAGES);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < images.size(); i++) {
sb.append(images.get(i).getName() + "\n");
imageFile = new File(images.get(i).getPath());
fileList.add(imageFile.getAbsoluteFile());
bitmap = BitmapFactory.decodeFile(fileList.get(i)+"");
}
// System.out.println("Images :" + bitmap);
tvtest.setText(sb.toString());
}
}
0
A
回答
1
我想你的意思是「如何在數組中包含多個圖像」。
您可以使用ArrayList來存儲你的位圖:
ArrayList<Bitmap> arrayListOfBitmaps = new ArrayList<Bitmap>();
for (int i = 0; i < images.size(); i++) {
imageFile = new File(images.get(i).getPath());
bitmap = BitmapFactory.decodeFile(fileList.get(i)+"");
arrayListOfBitmaps.add(bitmap); // Add a bitmap
}
或者,如果你真的想用一個數組:
Bitmap[] bitmapArray = new Bitmap[10];
但請小心使用位圖。他們可以吃掉很多設備資源,這將導致OutOfMemoryError。
+0
現在該如何發佈這個數組。 – user5653405
+0
@ user5653405你在網絡中使用哪個庫? – szholdiyarov
相關問題
- 1. 如何通過在RecyclerAdapter多個陣列Android Studio中
- 2. 鍵盤圖像編碼 - Android Studio
- 3. 在Android中縮放/格式化多個圖像按鈕陣列
- 4. 角JS圖像陣列編碼麻煩
- 5. Android Studio中陣列
- 6. 如何在android編程中使用多個圖像?
- 7. 如何在編輯文本中插入多個圖像android
- 8. 在Android中洗牌陣列圖像
- 9. Android:在圖像視圖中顯示圖像陣列
- 10. Android - 如何添加多個陣列到列表視圖
- 11. 在Android中使用多部分實體發送圖像陣列
- 12. Android 2D圖像陣列
- 13. 如何在Android中使用圖像創建工作陣列?
- 14. C#打開多個圖像陣列
- 15. 如何創建一個圖像陣列
- 16. 如何在json中編碼圖像url?
- 17. 如何在HTML中編碼圖像?
- 18. 如何在陣列中一個一個地顯示圖像?
- 19. 如何一次將多個圖像資產導入到android studio?
- 20. 如何在Android中從圖庫中選擇多個圖像?
- 21. 如何在圖像鏈接3個活動(Android Studio中)
- 22. 如何在android中將圖像編碼爲h264?
- 23. 如何準備多個RGB圖像作爲CNN的numpy陣列
- 24. 如何從圖像陣列在javascript
- 25. 如何在matlab中創建一個圖像陣列
- 26. 如何編碼圖像?
- 27. JSON多個陣列解碼
- 28. 如何在Android中將多個圖像組合成單個圖像?
- 29. 如何在多個圖像
- 30. 如何在拾取器視圖中獲取多個陣列
編碼?我不確定你的問題是什麼?添加一些解釋。 – Wizard
我想上傳多個圖像到服務器。所以如何在遠程服務器上上傳多個圖片。 – user5653405
我建議你使用amazon的s3服務器。這裏是github示例鏈接https://github.com/awslabs/aws-sdk-android-samples – Wizard