android - Textview not showing aftert couple of VISIBLE and INVISIBLE set -


first, used animation hide , show textview. saw using animation costing memory. used way:

setvisibility(visible) , setvisibility(invisible) tasktimer

it works , performs better considering memory.

the main issue after restarting timer many times, textview disappear.

i need restart app again!

this code snippet:

mytimerforanimation = new timer(); mytimerforanimation.scheduleatfixedrate(new timertask() {   @override   public void run() {       runonuithread(new runnable() // run on ui thread       {           public void run() {               counter++;               if (counter < 7) {                   if (counter % 2 == 1) {                       list_textview[x].setvisibility(view.invisible);                    } else {                       list_textview[x].setvisibility(view.visible);                    }               } else {                   mytimerforanimation.cancel();                   mytimerforanimation.purge();                    list_textview[x].setvisibility(view.visible);               }           }       });   } }, 1000, 600); 

dont use timer use handler,something this:

// init runnables // runnable should members handler hanlder = new handler();//if arent on ui thread pass correct looper  (int i=1; i<7 ; i++){   long delay = * 1000;   if (i%2==0)   {      handler.postdelayed(mvisiblerunnable,delay);   }else{      handler.postdelayed(minvisiblerunnable,delay);   } } 

whereas runnablebs should memebers because if u choose cancel callbacks call

handler.removecallbacks(runnable); 

play it. should fix issue.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -