2012-07-11 4 views
0

안녕하세요, 저는 애니메이션을 가지고 있는데, 실행 가능한 애니메이션의 시작을 지연시키고 싶지만 그 애니메이션을 반복 할 필요가없는 애니메이션을 지연시키고 실행하고 싶습니다. 한번 아무도 어떻게 알 수 있습니까?안드로이드는 runnable을 한 번만 실행합니다.

을 heres 내 코드 그것은 당신이 호출과 핸들러에 다시 게시하는 실행 가능한 내부에 있기 때문에 루핑

public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.layout_initialsetup); 
     handler = new Handler(); 
     final Runnable r = new Runnable() 
     { 
      public void run() 
      { 
       animations(); 
       handler.postDelayed(this, 1000); 
      } 
     }; 
     handler.postDelayed(r, 1000); 
    } 


    public void animations(){ 
     image = (ImageView)findViewById(R.id.su_shirts); 
     AnimationMovepos = AnimationUtils.loadAnimation(this, R.anim.shirt_anim); 
     image.startAnimation(AnimationMovepos); 
    } 
} 

답변

6

:

handler.postDelayed(this, 1000); 

것을 제거하고는

루프하지 않습니다
+0

10 분 동안 받아 들일 수 없다는 것을 고맙겠습니다.하지만 –

+5

매우 긴 시간이 걸릴 수 있습니다. –

+3

그는 블랙홀에 너무 가깝습니다. –

2

run() 방법으로 handler.postDelayed(this, 1000);을 삭제 해보세요.