如何从图库中检索图像的 Picasa ID/URL
我有一个活动,从设备的图库中检索图像并将其上传到服务。现在,出于优化目的,我希望避免上传 Picasa 上的图像,而只存储其 ID 或 URL 以供以后检索。
所以我的问题是,如何检索该信息。我的意图代码粘贴在下面并检索图像的 URI。
Intent galleryIntent = new Intent();
galleryIntent.setType("image/*");
galleryIntent.setAction(Intent.ACTION_PICK);
startActivityForResult(galleryIntent, GALLERY_PIC_REQUEST);
我尝试查找 PICASA_ID (MediaStore.Images.Media.PICASA_ID),但是通过使用上面的方法,它返回 null。有什么想法吗?
I have an activity that retrieves images from the device's gallery and uploads to a service. Now, for optimisation purposes, I would like to avoid uploading images that are on Picasa an just store their ID or URL for later retrieval.
So my question is, how do I retrieve that information. My intent code is pasted below and retrieves the URI of the image.
Intent galleryIntent = new Intent();
galleryIntent.setType("image/*");
galleryIntent.setAction(Intent.ACTION_PICK);
startActivityForResult(galleryIntent, GALLERY_PIC_REQUEST);
I tried to look for the PICASA_ID (MediaStore.Images.Media.PICASA_ID), but by using the method above, it returns null. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
启动
ACTION_GET_CONTENT
意图而不是ACTION_PICK
为临时文件提供
MediaStore.EXTRA_OUTPUT
额外内容以及URI
。将其添加到您的调用活动中:
现在使用此代码获取 Intent:
请确保
yourFile 创建
也在您的调用活动中
Launch an
ACTION_GET_CONTENT
intent instead of anACTION_PICK
Provide a
MediaStore.EXTRA_OUTPUT
extra with anURI
to a temporary file.Add this to your calling activity:
Now use this code to get Intent:
MAKE SURE THAT
yourFile
is createdAlso in your calling activity
我也用过同样的方法,它很有效。希望它也能帮助你..
I have used the same approach and it woks.Hope It could help u too..