1

我准备了一个应用程序。

我的应用程序有带有可绘制动画的启动画面。当应用程序启动时显示白屏(1 或 2 秒)并显示我的启动动画。有一段时间动画没有完成它是移动到下一个屏幕。我想我犯了一些错误我的代码是,

splashAnimation = (AnimationDrawable) imgAnim.getBackground();
        imgAnim.post(new Runnable() 
        {
            public void run() 
            {
                if ( splashAnimation != null ) 
                    splashAnimation.start();
              }
        });

        System.out.println("----------"+splashAnimation.getNumberOfFrames());

          for(int i = 0; i< splashAnimation.getNumberOfFrames();i++)
          {  
           totalDuration += splashAnimation.getDuration(i);  
          }  
          Timer timer = new Timer();  

       TimerTask timerTask = new TimerTask()
       {  
           @Override  
           public void run() 
           {  
               splashAnimation.stop(); 
                    Message msg = new Message();
                     msg.arg1 = 1;
                     uiHandler.sendMessageDelayed(msg, Constants.ZOOM_ANIM_DELAY);

                     //zoomAnimation();
            }
        };  
       timer.schedule(timerTask, totalDuration);

如何减少应用启动时间?

4

0 回答 0