android - Why is my animation showing just on first execution? -
my app starts opening (welcome) activity shows brief frame animation. i'm using this class so. first time run app works fine. if finish it, next times animation doesn't show @ all. way can see again forcing termination first (from android app manager).
this how i'm starting animation:
protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); setcontentview(r.layout.activity_opening); imageview img = (imageview)findviewbyid(r.id.openinganimimg); frameanimation = fasteranimationscontainer.getinstance(img); prepareframes(); frameanimation.setonanimationstoppedlistener(this); frameanimation.start(); }
once animation finishes, start activity.
close app, i'm using key until there no more activities on stack. may important mention opening activity has nohistory="true"
, it's not reachable once second activity starts.
i tracked problem , found strange behaviour on function:
private class framessequenceanimation implements runnable{ @override public void run() { imageview imageview = msoftreferenceimageview.get(); if (!mshouldrun || imageview == null) { misrunning = false; if (monanimationstoppedlistener != null) { monanimationstoppedlistener.onanimationstopped(); } return; } misrunning = true; /* isshown() returning false here! */ if (imageview.isshown()) { animationframe frame = getnext(); getimagedrawabletask task = new getimagedrawabletask(imageview); try { task.execute(frame.getresourceid()); }catch(rejectedexecutionexception ree){ log.e("animation", "rejected execution"); } mhandler.postdelayed(this, frame.getduration()); } } }
so imageview not showing animation because commented line returning false. why happening? , why program work first time? what's changing between first , second execution?
if need more information or wasn't clear, let me know.
Comments
Post a Comment