• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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 get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic