title: Create animated splash screen using frames on Android
body: <p>So here's the deal, I've searched every single question and link online but none are helpful.
  I have 120 frames of an animation in .jpg format for my splash screen. I understand that jpegs are converted to bitmaps on memory so that's why I get an OutOfMemoryError. The maximum frames I get to animate are 10. Is there any way to do this frame by frame, or should I try something else. Here's my code:</p>
  
  <pre><code>    final AnimationDrawable anim = new AnimationDrawable();
      anim.setOneShot(true);
  
      for (int i = 1; i &lt;= 120; i++) 
      {
          Drawable logo = getResources().getDrawable(getResources()
                    .getIdentifier("l"+i, "drawable", getPackageName()));
  
          anim.addFrame(logo, 50);
          if (i % 3 == 0)
          {
              System.gc();
          }
      }
  
      ImageView myImageView = (ImageView) findViewById(R.id.SplashImageView);
      myImageView.setBackgroundDrawable(anim);
      myImageView.post(new Runnable()
      {
         public void run()
         {
            anim.start();
         }
      });
  </code></pre>
  
  <p>I've placed the 120 jpegs under the drawable folder with an "l" prefix (eg l1, l2 etc).
  I do garbage collection every 3 jpegs but that won't do a thing.</p>