1

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

James
  • 486
  • 1
  • 9
  • 24

1 Answers1

3

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/

Community
  • 1
  • 1
xil3
  • 16,305
  • 8
  • 63
  • 97
  • That link looks to be a great help so thank you for that... However, i still dont fully know how to select my file, i am very new to android and the sounds of building an alert dialog to do it sounds very tricky, is there nothing like the html code, input type file? – James Feb 03 '11 at 17:01