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.

unwind
  • 391,730
  • 64
  • 469
  • 606

1 Answers1

4

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_IMAGE_CAPTURE 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();
// ...
}
}
Intrications
  • 16,782
  • 9
  • 50
  • 50