tags:

views:

192

answers:

1

Being a newbie to Android I can't work out how to call the camera application (or you can say camera preview?) when I click a button in my custom application.

+1  A: 

If you want to incorporate the camera preview into your app have a look at this webpage: http://p2p.wrox.com/book-professional-android-application-development-isbn-978-0-470-34471-2/72528-article-using-android-camera.html

Alternatively you can use the android.media.action.IMAGE_CAPTURE intent to request an image from the built in camera app, see http://developer.android.com/reference/android/provider/MediaStore.html#ACTION%5FIMAGE%5FCAPTURE and use code like:

Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 0);
// ...

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == Activity.RESULT_OK && requestCode == 0) {
String result = data.toURI();
// ...
}
}
AshtonBRSC