but, I can't use it since it's protected
It is designed to be called from a subclass of CameraFragment
, and a protected
method is available to subclasses.
I'm using the CameraDemo - Layout as an example
And you can see a call to setCameraView()
in onCreateView()
of the DemoCameraFragment
in that sample:
@Override
public View onCreateView(LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState) {
View content=inflater.inflate(R.layout.camera, container, false);
CameraView cameraView=(CameraView)content.findViewById(R.id.camera);
setCameraView(cameraView);
return(content);
}
should I follow the rule "You do not need to call this..." because I don't quite understand that part?
Either you are creating an instance of a CameraView
yourself (via a constructor or layout inflation), or you are not.
If you are creating such an instance, and you want to use a CameraFragment
subclass, that subclass must call setCameraView()
, passing in the CameraView
instance.
If you are not creating such an instance, instead allowing the stock implementation of CameraFragment
to create a CameraView
for you, you do not need to call setCameraView()
, in part because you do not have a CameraView
to set.