[英]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.