Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8365629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:42:16+00:00 2026-06-09T12:42:16+00:00

I use ActionBar tabs with multiple fragments. Each fragment contains a timer based on

  • 0

I use ActionBar tabs with multiple fragments. Each fragment contains a timer based on my timer service. When I stop my first timer (stopping the timer-service) the second timer stops aswell, I guess that’s because they are running the same service.

Is it possible to distiguish if another fragment is using the service or maybe to start individual services for each timer? Or is there another way of doing it?

I have been looking for a solution for some time now, I’m a bit lost right now.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:42:17+00:00Added an answer on June 9, 2026 at 12:42 pm

    Without seeing your code: a call to the method startService will either start the service if it isn’t running or call onStartCommand if the service is already started. When a timer starts you could call startService and increment a value(for example a int value representing the live timers). When a timer needs to stop/finishes you could implement a BroadcastReceiver in the Service(like in the link you’ve shown) to listen for a “close” broadcast coming from other components(you could use this pattern to let the Service know that a new timer has started(a “start” broadcast)).

    In that BroadcastReceiver from the Service you would decrement the live timers count and see if you are at 0, if this is the case then stop the Service.

    The main problems with the above approach is when to reliable close the Service even if the other activities get killed and are not getting restarted so they can not broadcast the required timer closed intents(if the other activities get killed and are not restarted the service could be left with some registered timers and you wouldn’t want the service to run indefinitely). To solve this it would require more details about your actual code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to use fragment tabs on action bar with the Theme.Holo.NoActionBar theme?
I have a system of actionbar Tabs with ABS. The first tab is a
I'm trying to use Navigation Tabs to change between some Fragments as like as
i use Sherlock Actionbar 1, i wanna change Home Button BG when i press
I've been trying to use the setActionView from the ActionBar in ICS Seems like
Is there a native way to swipe/fling between different ActionBar tabs (the Honeycomb/ICS native
I have a very simple code where I use Action Bar with tab fragments.
Using ActionBar Sherlock to implements tabs, I have a new TabsAdapter object declared and
I've made a simple Android Activity with an ActionBar to switch between 2 fragments.
Is it possible to use ActionBar without activity? I want to use it in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.