选择图片并上传android

发布于 2024-10-15 21:40:45 字数 190 浏览 3 评论 0原文

问题是...

我正在尝试创建一个应用程序,允许您将图像或录音以及一些信息上传到数据库,上传部分不是问题,我想做的是3个选项,拍照、录音和选择文件。我决定先解决选择文件的问题...是否可以简单地单击一个按钮来选择一个文件,然后将其发布到我的 php 脚本中?以及有关如何启动相机或录音机的指示也将不胜感激,

谢谢

詹姆斯

Here is the problem...

I'm trying to create an app that allows you to upload an image or sound recording to a database along with some information, The upload part isn't a problem, what I would like to do is have 3 options, take a photo, record a sound and select a file. I decided to tackle select a file first... Is it possible to be able to simply click a button which allows you to select a file then post that to my php script? and pointers on how to start the camera or sound recorder would also be appreciated greatly

Thanks

James

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

聆听风音 2024-10-22 21:40:45

您可以使用带有 ListView 的对话框来选择文件。选择文件后,您可以查看本教程以将其上传到您的网络服务:

http://www.anddev.org/upload_files_to_web_server-t443-s30.html

您可以使用意图来启动相机:

Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, 1);

您可以在

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){
  // result code = 1
  // grab the image you took with the camera from data
}

位置捕获: *更新*

以下 该对话框,您可以查看这些链接以获取有关其创建的更多信息:

是否可以在对话框内创建列表视图?

http ://androidforums.com/application-development/53924-how-add-listview-dialog.html

另外,您可能需要熟悉 ArrayAdapter 来管理 ListView。

http://www.softwarepassion.com/android-series -自定义列表视图项目和适配器/

You could use a Dialog with a ListView for selecting your file. Once you've selected the file, you could check out this tutorial for uploading it to your web service:

http://www.anddev.org/upload_files_to_web_server-t443-s30.html

You can use an intent to start the camera:

Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, 1);

Which you can capture in:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){
  // result code = 1
  // grab the image you took with the camera from data
}

* Update *

Regarding the dialog, you could check out these links for more information on it's creation:

is it possible to create listview inside dialog?

http://androidforums.com/application-development/53924-how-add-listview-dialog.html

Also you'll probably need to familiarize yourself with the ArrayAdapter for managing your ListView.

http://www.softwarepassion.com/android-series-custom-listview-items-and-adapters/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文