I initially implemented a video capture application with all the camera and recording logic inside the activity. With my understanding of MVP design pattern, the view should not contain any logic other than the UI itself. So I was advised to hide the camera logic behind an interface. I don't really understand what was ment by hiding it in an interface. Does that mean I have to create an interface and have a separate class implement the features then hooking that up to the activity. Can anyone lead me to the correct understanding of that statement or provide any external help regarding this problem.
Here's a quick example to demonstrate what was described. You want to have all the camera related code within a separate class, and have an interface to describe the methods.
interface Recorder {
void recordVideo();
void takePicture();
}
class CameraRecorder implements Recorder {
void recordVideo() { ... }
void takePicture() { ... }
}
// Existing activity
class Activity {
Recorder recorder;
void main() {
recorder.takePicture();
}
}