如何在 Android 应用程序中上传从相机捕获的图像
在我的应用程序中,我放置了一个名为“添加照片”的按钮,当用户单击该按钮时,会出现一个弹出菜单,其中包含 2 个选项相机和图库。当我选择库时,我可以移动到设备的相册。以下是我用来访问移动库
public void library() 的代码 { 意图 myIntent = new Intent(Intent.ACTION_PICK); myIntent.setType(“图像/*”); startActivityForResult(myIntent, 1); }
无论我点击那里的图像,我都希望将其上传到一个网址中,
就像我通过相机捕获的图像也希望上传到一个网址中一样。
如何做到这一点有任何 API 或示例代码请帮助我
in my app i have placed a button called Add Photo, when the user clicks the button a pop up menu appears with 2 option camera and library. When i select library i am able to move to the photo album of the device. Following is the code which i am using to go to the mobile library
public void library()
{
Intent myIntent = new Intent(Intent.ACTION_PICK);
myIntent.setType("image/*");
startActivityForResult(myIntent, 1);
}
whatever image i click there i want it to be uploaded in an url,
in the same way the image which i capture through the camera also want to be uploaded in an url.
how to do this is there any API or example code pls help me
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
中获取图像的真实路径
这个SO答案解释了如何在 onActivityResult 如何从图库(SD 卡)中为我的应用程序选择图像?
然后查找有关如何使用 http 上传文件的示例,任何 Java 示例都应该工作,例如:
http://www.jguru.com/faq/view .jsp?EID=62798
This SO answer explains how to get the true path of the image in your onActivityResult
How to pick an image from gallery (SD Card) for my app?
Then look for an example on how to upload a file using http, any Java example ought to work, for instance:
http://www.jguru.com/faq/view.jsp?EID=62798