选择一张图片,并上传机器人 [英] Select a picture and upload android
问题描述
这是问题...
我试图创建一个应用程序,可以让你的图像或声音记录一些信息一起上传到数据库,上传的部分是没有问题的,我会想要做的是有3个选择,取照片,录制声音,并选择一个文件。我决定来解决选择一个文件第一...是否有可能能够只需点击一个按钮,让您选择一个文件,然后张贴到我的PHP脚本?并就如何启动相机或录音机三分球也将是极大的pciated AP $ P $
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
感谢
詹姆斯
推荐答案
您可以使用一个对话框,选择您的文件一个ListView。一旦你选择的文件,你可以看看这个教程上传到Web服务:
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);
,你可以捕捉:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){
// result code = 1
// grab the image you took with the camera from data
}
*更新*
关于对话框,你可以检查这些链接的详细信息,它的创建:
Regarding the dialog, you could check out these links for more information on it's creation:
的http://androidforums.com/application-development/53924-how-add-listview-dialog.html
另外,你可能需要一个ArrayAdapter熟悉管理您的ListView。
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/
这篇关于选择一张图片,并上传机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!