I have a fragment called CameraFragment.java
which uses a library called natario1 CameraView
. What this fragment allows is, basically, take a picture using the camera. The picture is saved to a path called "Feel". The problem is, every picture has the same name so, when they're saved, if there is already one picture in the directory with the same name of that one that is being saved, it just can't save. How can I manage to give different names to my pictures?
This is the code I use which sets the image name to image2
:
btnShoot.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
cmrView.addCameraListener(new CameraListener() {
@Override
public void onPictureTaken(final byte[] picture) {
super.onPictureTaken(picture);
CameraUtils.decodeBitmap(picture, new CameraUtils.BitmapCallback() {
@Override
public void onBitmapReady(Bitmap bitmap) {
imgUltimaFoto.setImageBitmap(bitmap);
imgUltimaFoto.setVisibility(View.VISIBLE);
saveImage(bitmap,"imagem2");
}
});
}
});
cmrView.capturePicture();
}
});