title: Android: Using GLSurfaceView inside a fragment
body: <p>In my old Activity based solution the setup looks like this:</p>
  <pre><code>glSurfaceView = new GLSurfaceView(this);
          registerForContextMenu(glSurfaceView);
          if (supportsEs2) {
              glSurfaceView.setEGLContextClientVersion(2);
              renderer = new GLRenderer(context);
              glSurfaceView.setRenderer(renderer);
              rendererSet = true;
          }
          else {
              Toast.makeText(context, &quot;This device does not support OpenGL ES 2.0.&quot;,Toast.LENGTH_LONG).show();
              return;
          }       
          setContentView(glSurfaceView);
  </code></pre>
  <p>So assuming that I want the same behavior, how can I use the renderer in a Fragment?</p>
  <p>Here is my very basic fragment:</p>
  <pre><code>public class SketchBoardFragment extends Fragment{
  
      public SketchBoardFragment(){}
  
      public static SketchBoardFragment newInstance(){
          SketchBoardFragment fragment = new SketchBoardFragment();
          return fragment;
      }
  
      @Nullable
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          View rootView =     inflater.inflate(R.layout.fragment_sketch_board,container,false);
          return rootView;
      }
  
      @Override
      public void onAttach(Activity activity) {
          super.onAttach(activity);
          ((MainActivity)activity).onSectionAttached(1);
      }
  }
  </code></pre>
  <p>Thanks in advance.</p>