I’m using AnimationDrawable to show missing network connection.
Show/hide logic is linked to network status change receiver. It works fine.
But when start activity knowing status and try to start animation – animated drawable shows and freezes on first frame. I’ve read in documentation – ‘do not start animation in OnCreate’.
So I wrote code in onResume, but animation still not playing – only shows first frame.
Starting from button or event works fine.
Tried to start with separate thread and wait some time – but this doent sounds good.
Any idea?
This code works when called from net status change handler
private void _NetStatus(boolean start)
{
if (start)
{
m_NetStatus.setVisibility(View.VISIBLE);
m_NetStatusFrameAnimation.start();
}
else
{
m_NetStatusFrameAnimation.stop();
m_NetStatus.setVisibility(View.INVISIBLE);
}
}
Hmm. After trying some samples advising me to use new Runnable at end of onCreate – I tried to start animation when activity shows on screen:
Works fine for now.