How to manage memory from a postDelay in android? -


i'm developing application needed animation of typewriter , found code snippet in internet typewriter effect notice when i'm continuously running app typewriter effect became slow. know it's because of postdelay method used in typewriter effect. please me how manage memory while using postdelay.

this code used typewriter effect

private handler mhandler = new handler(); private runnable characteradder = new runnable() { @override public void run() {     tv.settext(mtext.subsequence(0, mindex++));     if(mindex <= mtext.length()) {     mhandler.postdelayed(characteradder, mdelay);     } } };  public void animatetext(charsequence text) { mtext = text; mindex = 0;  tv.settext(""); mhandler.removecallbacks(characteradder); mhandler.postdelayed(characteradder, mdelay); }  public void setcharacterdelay(long millis) {      mdelay = millis; } 


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -