title: ArrayIndexOutOfBoundException on calling View.draw(Canvas) method
body: <p>I am trying create bitmap from a Linear Layout in a asynctask(). Please find the code here:</p>
  
  <pre><code>while (running) {
          count++;
          v1.draw(new Canvas(bitmap));//I am getting exception here
          //sleep thread to give some lag
      try {
              Thread.sleep(30);
          } catch (InterruptedException e) {
              e.printStackTrace();
              throw new RuntimeException(e.getMessage());
          }
  
          System.out.println("Bitmap : [ " + count + " ] &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; SAVED. ");
  
      }
  </code></pre>
  
  <p>And I am getting the error as:</p>
  
  <pre><code>04-21 16:29:46.768: E/AndroidRuntime(20850): Caused by: java.lang.IndexOutOfBoundsException: 1, 1
  04-21 16:29:46.768: E/AndroidRuntime(20850):    at android.text.PackedIntVector.getValue(PackedIntVector.java:70)
  04-21 16:29:46.768: E/AndroidRuntime(20850):    at android.text.DynamicLayout.getLineTop(DynamicLayout.java:592)
  04-21 16:29:46.768: E/AndroidRuntime(20850):    at android.text.Layout.getLineForVertical(Layout.java:1015)
  04-21 16:29:46.768: E/AndroidRuntime(20850):    at android.text.Layout.getLineRangeForDraw(Layout.java:460)
  04-21 16:29:46.768: E/AndroidRuntime(20850):    at android.text.Layout.draw(Layout.java:198)
  04-21 16:29:46.768: E/AndroidRuntime(20850):    at android.widget.Editor.onDraw(Editor.java:1306)
  04-21 16:29:46.768: E/AndroidRuntime(20850):    at android.widget.TextView.onDraw(TextView.java:5163)
  04-21 16:29:46.768: E/AndroidRuntime(20850):    at android.view.View.draw(View.java:14465)
  04-21 16:29:46.768: E/AndroidRuntime(20850):    at android.view.View.draw(View.java:14350)
  04-21 16:29:46.768: E/AndroidRuntime(20850):    at android.view.ViewGroup.drawChild(ViewGroup.java:3103)
  04-21 16:29:46.768: E/AndroidRuntime(20850):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2940)
  04-21 16:29:46.768: E/AndroidRuntime(20850):    at android.view.View.draw(View.java:14468)
  04-21 16:29:46.768: E/AndroidRuntime(20850):    at com.sample.ScreenShotTask.takeScreenshots(ScreenShotTask.java:75)
  04-21 16:29:46.768: E/AndroidRuntime(20850):    at com.sample.ScreenShotTask.doInBackground(ScreenShotTask.java:35)
  04-21 16:29:46.768: E/AndroidRuntime(20850):    at com.sample.ScreenShotTask.doInBackground(ScreenShotTask.java:1)
  04-21 16:29:46.768: E/AndroidRuntime(20850):    at android.os.AsyncTask$2.call(AsyncTask.java:288)
  04-21 16:29:46.768: E/AndroidRuntime(20850):    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
  04-21 16:29:46.768: E/AndroidRuntime(20850):    ... 4 more
  </code></pre>
  
  <p><strong><em>Can anybody help?</em></strong></p>