如何启动附加位图的活动?
我有这个代码:
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
startActivity(intent);
它成功地在android上启动了一个消息应用程序。
但是如何在启动意图时附加位图对象呢?
我已阅读 http://developer.android.com/reference/android/content /Intent.html, 我需要的最接近的是 EXTRA_STREAM,如下所示: Intent2.putExtra(Intent.EXTRA_STREAM, _uri);
但我的情况是,我有 Bitmap 对象的引用,而不是 位图。
请告诉我如何附加位图对象?
谢谢。
I have this code:
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
startActivity(intent);
which successfully launches an Messaging App on android.
But how can i attach a Bitmap object when launching the intent?
I have read http://developer.android.com/reference/android/content/Intent.html,
the closet thing to what i need is EXTRA_STREAM, like this:
intent2.putExtra(Intent.EXTRA_STREAM, _uri);
but my case, I have a reference of Bitmap object, not an URI of an
Bitmap.
Please tell me what can I do to attach a Bitmap object?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我也有同样的问题。 我尝试了这个:
但是当我运行该程序时,它无法启动新活动。 看来系统此时已经卡住了。 UI 未呈现,而是黑屏。 我等了一会,它问我是否要强行退出。
简而言之,我们如何在Activity之间传递Bitmap数据呢?
谢谢
I'm having kind of the same problem. I tried this:
But when I ran the program, it couldn't launch the new activity. It looked like the system was stuck at this point. The UI was not rendered but a black screen instead. I waited for a while and it asked me whether I wanted to force quit.
In short, how to we pass Bitmap data between activities?
Thanks
并在另一端检索它:
and retrieve it on the other end: