title: Android onDraw() is not getting called on Timer
body: <p>This is in  GraphView.java which extends View. I want that when this invalidate(bounds) is getting called, at the same time it should call  onDraw().. What is bug in this code. It is giving me this exception.</p>
  
  <blockquote>
  <pre><code> 01-01 00:45:42.813: E/AndroidRuntime(1586): FATAL EXCEPTION: Timer-2
   01-01 00:45:42.813: E/AndroidRuntime(1586): java.lang.NullPointerException
    01-01 00:45:42.813: E/AndroidRuntime(1586):     at          android.view.View.invalidate(View.java:8467)
    01-01 00:45:42.813: E/AndroidRuntime(1586):     at        com.cdl.mircam.GraphView$1.run(GraphView.java:327)
  01-01 00:45:42.813: E/AndroidRuntime(1586):   at java.util.Timer$TimerImpl.run(Timer.java:284)
  </code></pre>
  </blockquote>
  
  <pre><code>@Override
  public void onDraw(Canvas c) 
      {
          super.onDraw(c);
          drawStuff(c);
      }
  
  
   public void drawStuff(Canvas canvas) 
     {    
     try
      {
          PlotRealTimeGraph(canvas);
          bounds = new Rect(chanX_count1+0, 0, chanX_count1+5, graphheight);
          canvas.drawRect(bounds,myPaint);
          }
     catch(Exception e1)
      {
      e1.printStackTrace();
      }
    }   
  
  
      public void InvalidatePlotRealTimeGraph()
       {
          Timer t = new Timer();
          t.scheduleAtFixedRate(new TimerTask() {
         @Override
          public void run() 
          {
             invalidate(bounds);
          }     
        },1000,40);   
      } 
  </code></pre>
  
  <p>Any help? please!!!</p>