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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:28:33+00:00 2026-06-02T22:28:33+00:00

I am trying to update the UI (Activity) after some action has been performed

  • 0

I am trying to update the UI (Activity) after some action has been performed in the service. This is very simple example but it doesn’t seem to work for me. What am I missing here?

ExampleService:

  public class ExampleService extends IntentService{
    @Override
    protected void onHandleIntent(Intent intent) {
        notifyActivity();
    }

    private void notifyActivity() {
        Intent broadcast = new Intent(this, ExampleActivity.class);
        sendBroadcast(broadcast);
    }
  }

ExampleActivity:

public class ExampleActivity extends ListActivity {
         private BroadcastReceiver receiver = new BroadcastReceiver() {

    @Override
    public void onReceive(Context context, Intent intent) {
         Toast.makeText(getApplicationContext(), "received", Toast.LENGTH_SHORT).show();
        }
    };

    @Override
    protected void onPause() {
        super.onPause();
        unregisterReceiver(receiver);
    }

    @Override
    public void onResume() {
        super.onResume();
        IntentFilter filter = new IntentFilter();
        registerReceiver(receiver, filter);
    }
}
  • 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-02T22:28:35+00:00Added an answer on June 2, 2026 at 10:28 pm

    You cannot send a broadcast to an anonymous dynamic receiver that way. You will need to define an action string in the Intent and use that action string in the IntentFilter.

    You might consider using LocalBroadcastManager for this scenario, for better performance. Here is a sample project demonstrating this.

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

Sidebar

Related Questions

Im trying to update the contents of an element after running some php code.
I've been trying to update my app and get going with fragments, the action
I've been quite some time trying to use the Containable Behavior in CakePHP but
I am trying update text views while this loop is processing. Here is my
I trying to update a model on a callback but the validation is causing
I'm querying a very large activity log in a MySQL database, trying to figure
I have been trying to update a TextView field, when i Tap on the
I'm trying to make a widget to my app, but it doesnt update. I
I'm trying to update the progress bar in a AsyncTask while downloading some stuff..
Trying to simple update a row in an SQLiteDatabase Database. I can insert records

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.