简体   繁体   English

什么是从一个活动传递图像在Android中的最佳方法

[英]what is the best way to pass image from one activity another in android

In my apps, i need to pass image of image view from one activity to another. 在我的应用程序中,我需要将图像视图的图像从一项活动传递到另一项活动。 I know there are different kinds of way to pass image from activity to activity. 我知道有多种方法可以将图像从活动传递到活动。 But i want to know the best approach to do that. 但是我想知道做到这一点的最佳方法。 Previously i tried to pass image by getting the Bitmap of imageview from first activity then put in as putextra to the intent then extract the bitmap by getPercible to second activity. 以前,我尝试通过从第一个活动获取imageview的位图来传递图像,然后将其作为putextra放入意图中,然后通过getPercible将位图提取到第二个活动。 This was working good in Lollipop but getting error in Nougat. 这在棒棒糖中运行良好,但在牛轧糖中却出错。 Now, i am trying to pass the bitmap as byteArray, but this is more unreliable than previous one. 现在,我正在尝试将位图作为byteArray传递,但这比上一个更加不可靠。 I don't know how to overcome this situation. 我不知道如何克服这种情况。 Please help me in this context. 请在这种情况下帮助我。

Where do you get your image from? 您从哪里获得图像?

I would advise you to store it locally and only pass the path to it to the other activity. 我建议您将其store it locally and only pass the path to it给其他活动。 In this activity just retrieve the Bitmap again from your local storage. 在此活动中,只需从本地存储再次检索位图。

暂无
暂无

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

相关问题 将 Drawable 从一个活动传递到另一个活动的最佳方法是什么? - What is the best way to pass a Drawable from one activity to another? 将对象从一种活动传递到另一种活动的最佳方法 - Best way to pass objects from one activity to another Android将对象传递到另一个活动的最佳方法 - Android best way to pass object to another activity Android如何将图像从图像视图传递到文本并将文本从文本从一个活动传递到另一个活动 - Android how to pass image from image view and text from text from one activity to another activity 将集合传递给另一个活动的最佳方法是什么? Java Android SDK - What is the best way to pass a set to another activity. Java Android SDK 如何将图像从一项活动传递到另一项活动 - How to pass image from one activity to another 将位图图像从一个活动传递到另一个活动 - pass a bitmap image from one activity to another 哪种方法是将大量数据(即对象)从一个Activity转移到Android中的另一个Activity? - Which is the best way to transfer bulk of data (i.e. objects) from one Activity to another Activity in Android? 哪种方式更适合将大量数据从一个活动传递到另一个活动 - android? - Which way is better for pass a large list of data from one activity to another activity - android? 在访问Firebase Firestore时,Android Studio中是否有任何方法可以将集合引用从一个活动传递到另一个活动? - Is there any way in the android studio to pass a colllection reference from one activity to another activity in accessing the firebase firestore?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM