title: Android TextureView canvas drawing problems
body: <p>I have an app that used SurfaceView to draw dynamic 2D graphs. It worked ok but transformations etc as we know are not supported. So I went to TextureView. My old code used another class/thread to do the drawing via the Surfaceholder.lockCanvas(); So I changed this to TextureView.lockcanvas. When this runs the canvas not accelerated (the view is) does not display initially but if I touch the screen onSurfaceTextureUpdated (currently with no code inside) is called and it displays???</p>
  
  <pre><code>protected void RenderCanvas(){
  //mCanvas = null;
  Canvas c = null;
  //synchronized (mCanvas) {
      //mCanvas = null;
      try {
          c = mChartView.lockCanvas(null);
           if (!c.isHardwareAccelerated()) {
                 Log.w("GVIEW", "A TextureView or a subclass can only be "
                           + "used with hardware acceleration enabled.");
             }
          synchronized (mCanvas) {
              c.drawBitmap(buffBitmap, 0, 0, null);
  
          }
      } finally {
          // do this in a finally so that if an exception is thrown
          // during the above, we don't leave the Surface in an
          // inconsistent state
          if (c != null) {
              mChartView.unlockCanvasAndPost(c);
              //mSurfaceHolder.updateTexImage();
          }
      }
  </code></pre>
  
  <p>}</p>
  
  <p>I implement the SurfaceTextureListener within my TextureView and all of the program flow seems fine a real surface is handed to the plotting thread by</p>
  
  <pre><code>@Override
  
  public void onSurfaceTextureAvailable(SurfaceTexture surface, int width,
  
          int height) {
  
      // TODO Auto-generated method stub
  
      isRunning = true;
  
      mySurface = surface;
  
      mChart.setTextureSurface(surface);
  
      mChart.setSurfaceSize(width, height);
  
      mChart.Redraw(true) 
  
  }
  </code></pre>
  
  <p>This void finishes with the RenderCanvas() above.</p>
  
  <p>Redrawing or invalidating the view also doesn't work unless i again touch the screen.</p>
  
  <p>Cannot I not use TextureView like this? </p>
  
  <p>Does it have to be openGl content stream?</p>