• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

Retain chronograph counting during screen rotation

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,

I have a simple app that starts a counter when start button is pressed. I would like the counter to keep counting even during screen rotations. For that i've put the Chronometer in a fragment and used setretaininstance. The idea is to store the time counted in parameter elapsedMillis, and use this to update the chronometer when isCounting = true. Put in simple words, i want a timer that keeps counting even during screen rotation. This, however doesn't work at all - after screen rotation i can't even start it. What is wrong?

MainActivity:


MainFragment:


activity_main:


fragment_main:


 
"Don't believe every tiny ad you see on the internet. But this one is rock solid." - George Washington
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic