简体   繁体   English

从图库中选择一个图像并发送到另一个活动

[英]Choose a Image from Gallery and send to another Activity

So I have an app and in this app in the first activity you choose a image from the gallery or take a photo with the camera. 因此,我有一个应用程序,在该应用程序的第一个活动中,您从图库中选择图像或使用相机拍照。

Then there are a few Activitys between the Activity I needed the picture. 然后,在我需要图片的“活动”之间有一些“活动”。 So how can I send this image choosen in the first Activity to the activity i need it in? 那么,如何将在第一个活动中选择的图像发送到需要它的活动中? I thought I can make it like these putExtra() Method but I was reading that I costs a lot of memory to send bitmaps to another Activity. 我以为可以像这样的putExtra()方法那样使它工作,但我读到我花了很多内存才能将位图发送到另一个Activity。

My Goal is to edit this Image as a bitmap in the last activity! 我的目标是在上一个活动中将此图像作为位图进行编辑!

So who got some solutions how i can fix this Problem?! 那么,谁得到了一些解决方案,我可以如何解决此问题呢? Any Ideas? 有任何想法吗? Thank you! 谢谢!

I use Library called sandriosCamera, it is very costumizable and works in that it less than android 5.0 too (So use CameraApi and CameraApi2). 我使用称为sandriosCamera的库,它具有很高的可扩展性,并且它的工作原理也比android 5.0少(因此请使用CameraApi和CameraApi2)。 It includes recent image in gallery picker and too shows a preview of the image doing a matrix (Rotate) when the image has an incorrect orientation. 它包括图库选择器中的最新图像,并且当图像方向错误时,它也会显示矩阵(旋转)的图像预览。 Read this in android arsenal and look the github for the library code https://android-arsenal.com/details/1/4962 Then I pass with a putExtra() the image path (because of the image is temporal and then I need to getExtra() of the intent to have the path of the image in my SendActivity. Hope it helps with all your problems. PD: I recommend to download the master.zip and not to import as a library with gradle, because you can costumize if you want (But then you need to fix problems). Before of import to the gradle or manual I recommend too to update all your android tools, max version, etc. 在android arsenal中阅读此内容,并在github上找到库代码https://android-arsenal.com/details/1/4962,然后我将putExtra()传递到图像路径(因为图像是暂时的,所以我需要为了在我的SendActivity中具有图像的路径而进行getExtra() ,希望对您的所有问题有所帮助PD:我建议下载master.zip而不是使用gradle导入库,因为您可能会累赘如果您愿意(但是然后您需要解决问题)。在导入gradle或手册之前,我也建议您更新所有的android工具,max版本等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM