title: Android: how to access a camera instance from a fragment?
body: <p>How to get a camera instance from a fragment?</p>
  
  <p>Check this link below: <code>getCameraInstance()</code> is called without problems inside a <code>Fragment</code> class:</p>
  
  <p><a href="https://github.com/rexstjohn/UltimateAndroidCameraGuide/blob/master/camera/src/main/java/com/ultimate/camera/fragments/NativeCameraFragment.java" rel="nofollow">https://github.com/rexstjohn/UltimateAndroidCameraGuide/blob/master/camera/src/main/java/com/ultimate/camera/fragments/NativeCameraFragment.java</a></p>
  
  <p>but when I try to call <code>getCameraInstance()</code>, I get this:</p>
  
  <blockquote>
    <p>cannot resolve method getCameraInstance()</p>
  </blockquote>
  
  <pre><code>public class PhotoFragment extends Fragment {
  
  //...
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
  
      View rootView = inflater.inflate(R.layout.fragment_photo, container, false);
  
  
      // Create an instance of Camera
      mCamera = getCameraInstance();
  </code></pre>