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 782403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:22:53+00:00 2026-05-14T20:22:53+00:00

I have an Activity (A) and a Service (S) which gets started by A

  • 0

I have an Activity (A) and a Service (S) which gets started by A like this:

Intent i = new Intent();
i.putExtra("updateInterval", 10);
i.setClassName("com.blah", "com.blah.S");
startService(i);

A have a function like this one in A:

public void someInfoArrived(Info i){...}

Now I want to call A.someInfoArrived(i) from within S.
Intent.putExtra has no version where I could pass an Object reference etc …
Please help!

PS: The other way around (A polling S for new info) is NOT what I need. I found enough info about how to do that.

  • 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-14T20:22:54+00:00Added an answer on May 14, 2026 at 8:22 pm

    One option is to switch from startService() to bindService() and use the local binding pattern. Then, you need to have A call a method on S at some point to register a listener or callback method. Then, S will have something it can call on A when some info arrives. You can see a sample project for that here.

    Alternatively, you could leave startService() in place and use a broadcast Intent to let S tell A about some info arriving. You can see a sample project demonstrating such a broadcast Intent here.

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

Sidebar

Related Questions

I have an activity that starts a long-running service which in turn adds an
I have an issue when changing my screen orientation. I have an activity with
I am developing an application in Android and have an issue where Android framework
There is something I don't quite understand right now. My main activity class creates
Before using the Task Parallel Library, I have often used CorrelationManager.ActivityId to keep track
I have some problems spying on a real SimpleEventBus implementation of EventBus: I have
I am making a application that uses the GPS receiver. The application will work
I've implemented a simple Observer pattern in a hello world style app. I've got
Now that Microsoft has revamped their workflow framework in Windows Workflow Foundation 4, what
I am making a IM client for android and I am working with databases

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.