I had the same issue with photos but basically I also thought that getPhotoPath would return the path of the photo I had just taken.
So I read carefully CommonsWare answer, especially the part where he explains how getVideoPath() works.
That's because getVideoPath() is designed to be called by CameraView, to generate the >filename to be used for the video. getVideoFileName(), in turn, is used by getVideoPath(). >This has to be done before the video starts recording.
My understanding is that getVideoPath() is meant to be used by the system rather than by the developper. getVideoPath() calls getVideoFilename() and getVideoDirectory() to build the video path which will later be used by the system to save the video.
That being said, what we need to do (like CommonsWare already said), is to tell the system what path we want our file to be saved at. And we do this by overriding either getVideoFilename(), getVideoDirectory() or getVideoPath().
And once we control that, we can always call getVideoPath() once the video is saved, just to be sure we have the right path.
So since I was happy with the default directory, I just overrode getPhotoFilename() like this :
public class MyCameraHost extends SimpleCameraHost {
private String photoName;
private String extension = ".png";
public MyCameraHost(Context _ctxt) {
super(_ctxt);
// TODO Auto-generated constructor stub
}
@Override
protected String getPhotoFilename() {
// TODO Auto-generated method stub
return this.photoName + this.extension;
}
public void setPhotoName (String name){
this.photoName = name;
}
}
And in my camera activity, my takePhoto() method looks like this :
private void takePicture() {
CameraFragment f = (CameraFragment) getFragmentManager().findFragmentByTag(TAG_CAMERA_FRAGMENT);
if (f != null && f.isVisible()) {
cameraHost.setPhotoName("test");
f.takePicture();
pictureFile = cameraHost.getPhotoPath();
}
}
Hope this helps. And thanks CommonWares for this awesome library and your answers to our questions.