1

When the user hits the "settings dots" and pops up the menu shown, I want the timer to stop immediately (i.e., before user picks from the list), but I don't know where to put Timer.pauseTimer().

When the user taps one of the 4 items in the dropdown list, MainActivity.onOptionsSelected() is activated and I can pause the timer, but how do I get control at the instant the dots icon is tapped?

I had hoped onAttach would do it in the SettingsFragment, but no. Timer ticks away with the screen looking as shown below.

enter image description here

DSlomer64
  • 4,234
  • 4
  • 53
  • 88
  • 3
    You want to use [onPrepareOptionsMenu](http://developer.android.com/reference/android/app/Activity.html#onPrepareOptionsMenu(android.view.Menu)). – Eric Martinez Jul 19 '15 at 00:00
  • You're right--that's what gets called all right. My problem now (requiring a different question if I can't figure it out myself) is that the timer doesn't stop every time (it does sometimes!) even though I have this code: `@Override public boolean onPrepareOptionsMenu (Menu menu){ super.onPrepareOptionsMenu(menu); Timer.pauseTimer("Main onPrepOptMenu"); return true;}` – DSlomer64 Jul 19 '15 at 00:07
  • That'll definitely need a new question since you'll have to provide and post your code. You can reference this question if you need context for the new one. – Eric Martinez Jul 19 '15 at 00:10
  • 1
    I may have figured out the "iffy-ness"--there's a delay before the next flag is shown. If user taps overflow dots BEFORE next flag shows, timer does NOT stop. If user waits until next flag shows, it does. – DSlomer64 Jul 19 '15 at 00:12

0 Answers0