animation - Animating LinearLayout background to blink in Android -


the question simple can't manage find solution it. have linearlayout in activity. depending on user need make background of layout blink 3 times. means change background color transparent red , backwards 3 times. let me give example:

  1. the user receives question , 2 buttons answers
  2. the user presses wrong answer. layout containing button change it's background (transparent - red, transparent - red, transparent - red - transparen) 3 times.

how can make in android ? thank you.

you use handler postdelayed method. this:

    handler h = new handler();     int count = 0;     runnable r=new runnable()     {         public void run()          {             if(count < 6){                 if(count % 2 == 0){                     count++;                     layout.setbackground(red);                     h.postdelayed(r,500);                 }else{                     count++;                     layout.setbackground(transparent);                     h.postdelayed(r,500);                 }             }          }      };     h.post(r); 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -