lundi 29 décembre 2014

Android - Taking a picture with a camera


Vote count:

0




I am new to android, and I am trying to make my app take a picture from the camera. Looking at the example provided here, I tried to implement in my app in MainActivity.java as such:



static final int REQUEST_IMAGE_CAPTURE = 1;

public void dispatchTakePictureIntent(View view) {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
}


I am getting the following error:



java.lang.RuntimeException: Unable to start activity ComponentInfo{-----/.MainActivity}


Caused by:



java.lang.UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView


I am probably doing something wrong, so can anyone point out my mistake? Thanks in advance.



asked 1 min ago







Android - Taking a picture with a camera

Aucun commentaire:

Enregistrer un commentaire