title: android animation freeze
body: <p>I have an animation with 12 images that displays as a loading image. It works fine on its own, but when I use my httpClient class to get content from the online db, it freezes completely and when the content is done fetching, you can see the animation stopped on a different image.</p>
  
  <p>How can I make that the image load while the content is being fetched from the db ?</p>
  
  <p>Here is some code:</p>
  
  <p>Class members:</p>
  
  <pre><code>ImageView loading;
  AnimationDrawable loadAnimation;
  </code></pre>
  
  <p>onCreate:</p>
  
  <pre><code>    LinearLayout main = (LinearLayout) findViewById(R.id.loading);
      loading = new ImageView(this);
      loading.setImageResource(R.drawable.loading);
      loadAnimation = (AnimationDrawable)loading.getDrawable();
      main.addView(loading);
  </code></pre>
  
  <p>I use this to start the animation before the content is fetched:</p>
  
  <pre><code>loadAnimation.start();
  </code></pre>
  
  <p>And this when it is done fetching:</p>
  
  <pre><code>loadAnimation.stop();
  </code></pre>