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 logCodePudding user response:
https://bbs.csdn.net/topics/394814948Look at the trouble and then stick the log out