Home > Mobile >  An error occurred when takePicture method is always performed
An error occurred when takePicture method is always performed

Time:11-29

Refer to the manual of the official development, but with the old Camera class,
In the onClick implementation takePicture
 mCamera. TakePicture (null, null, mPicture); 


MPicture defined under the MainActivity
 private PictureCallback mPicture=new PictureCallback () {

@ Override
Public void onPictureTaken (byte [] data, Camera Camera) {

The File pictureFile=getOutputMediaFile (MEDIA_TYPE_IMAGE);
If (pictureFile==null) {
//the d (TAG, "Error creating media file, the check storage permissions");
return;
}

Try {
FileOutputStream fos=new FileOutputStream (pictureFile);
Fos. Write (data);
fos.close();
} the catch (FileNotFoundException e) {
//the d (TAG, "File not found:" + um participant etMessage ());
} the catch (IOException e) {
//the d (TAG, "Error accessing file:" + um participant etMessage ());
}
}
};

CodePudding user response:

Now is the button will flash back, my onClick method is defined in the activity_main, not use the method of the Listener, do not know to have relationships,

CodePudding user response:

Ah you log log

CodePudding user response:

https://bbs.csdn.net/topics/394814948
Look at the trouble and then stick the log out
  • Related