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

  • Home
  • SEARCH
  • 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 6807553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:50:47+00:00 2026-05-26T19:50:47+00:00

I have a Service downloading data every second from a web server (This Service

  • 0

I have a Service downloading data every second from a web server (This Service is launched from my main Activity). In my app there are other Activitys each of them needs to refresh their UI according to the data downloaded by the Service.

My idea is to give to each of my Activitys an AsyncTask which will retrieve a small amoumt of data from the Service every second. Then the AsyncTask will tell to the UI to update.

Until yesterday I was all doing through AsyncTask, but I read this morning on stackoverflow that retrieving data and giving it to several Activitys is more a Service job than an AsyncTask one.

So I came up with this (not-so-good-even-a-bit-crapy) solution because I can’t find how to notify my Activitys when the data is retrieved by the Service.
I read about broadcast receiver, listener, intent… but can’t figure out how I can make my Activity‘s “subscribe” to this one service periodically.

Thanks for your help.

PS : is it ridiculous to code sample each of my keywords in my writing like that 🙂 ?

PS2 : use case of my app is retrieving temperature, pressure etc… from web services and monitoring each of these quantities in a different Activity (I can’t monitor them all in the same Activity).

  • 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-05-26T19:50:48+00:00Added an answer on May 26, 2026 at 7:50 pm

    Data can be refreshed over activity from service thru Handler.

    1. In service you can create getter & setter of the handler.
    2. Set the handler of the activity when your activity starts that will make the service to have the handler of the activity which is currently visible.
    3. Use this handler instance to notify about data to the activity.

    Follow this link for handler.

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

Sidebar

Related Questions

I have a doubt regarding downloading data from a web service. One way is
I have a Service that is downloading a file from a server. I warn
My C# WinForms app downloads files from a .php downloading web service. The .php
I have WCF service hosted by Windows service. This is my app.config file (server-side)
I have a web service which you post data to and it returns you
I have a button in my app which leads to the UpdateActivity. This activity
I have a .net windows service that test network performance by downloading files from
I have a service that is downloading a file. When the download is done,
I currently have service classes that look something like this public class UserService :
I have a service app that creates AppDomain's during the course of its use

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.