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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:39:18+00:00 2026-06-12T13:39:18+00:00

I have multiple widgets. On update for each i start a service Code in

  • 0

I have multiple widgets. On update for each i start a service Code in service:

for (int widgetId : allWidgetIds) {

// Register an onClickListener for DisplayActivity
            Intent clickIntentUpdate1 = new Intent(
                    this.getApplicationContext(), DisplayActivity.class);
            clickIntentUpdate1.putExtra("widgetid", widgetId);
            clickIntentUpdate1.putExtra(DisplayActivity.WHAT, what);
            clickIntentUpdate1.putExtra(DisplayActivity.WHAT_COLOR, prefs
                    .getString(QuoteConfigure.PREF_PREFIX_KEY_QUOTE_COLOR
                            + widgetId, "Transparent"));
            clickIntentUpdate1.putExtra(DisplayActivity.WHO, who);
            clickIntentUpdate1.putExtra(DisplayActivity.WHO_COLOR, prefs
                    .getString(
                            QuoteConfigure.PREF_PREFIX_KEY_QUOTE_BY_COLOR
                                    + widgetId, "Transparent"));
            clickIntentUpdate1.putExtra(
                    DisplayActivity.BG_COLOR,
                    prefs.getString(QuoteConfigure.PREF_PREFIX_KEY_QUOTE_BG
                            + widgetId, "Transparent"));
            PendingIntent pendingIntentUpdate1 = PendingIntent.getActivity(
                    getApplicationContext(), 0, clickIntentUpdate1,
                    PendingIntent.FLAG_UPDATE_CURRENT);
            remoteViews.setOnClickPendingIntent(R.id.what,
                    pendingIntentUpdate1);
            Log.d("quoteSERVICE", what + " -> " + who);
            Log.d("quoteSERVICE", "what inside intent:"+clickIntentUpdate1.getExtras().getString(DisplayActivity.WHAT));
            Log.d("quoteSERVICE", "widgetid:"+widgetId);
            Log.d("quoteSERVICE", "--------------------");

            // Register an onClickListener for Who search
            Intent clickIntentSearch = new Intent(Intent.ACTION_VIEW);
            clickIntentSearch.setData(Uri
                    .parse("http://www.google.com/search?q=" + who));
            PendingIntent pendingIntentSearch = PendingIntent.getActivity(
                    getApplicationContext(), 0, clickIntentSearch, 0);
            remoteViews.setOnClickPendingIntent(R.id.who,
                    pendingIntentSearch);

            appWidgetManager.updateAppWidget(widgetId, remoteViews);
}
stopSelf();

Now the problem is:

I have two widgets and when they update intent on R.id.who is fired as it is supposed to be with the required data. However the event for R.id.what is not fired as it is supposed to be. The data sent on this event is the last values of what and who sent(i.e. the ones in the last widget to be updated.)

  • 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-12T13:39:19+00:00Added an answer on June 12, 2026 at 1:39 pm

    I could be wrong, but IIRC Android has a bug/quirk/feature that does not let you have multiple identical outstanding PendingIntents.

    That means if you create two pending intents that differ only by extras, the first one will be forgotten and when the intent fires it will send the last intent that was set.

    I think you can differentiate them by setting a bogus “Action”, that while unused, causes android to not assume the two intents are the same, and your code will work how you expect.

    Can you try inserting this statement below, and see if that fixes your problem?

    Intent clickIntentUpdate1 = new Intent(
                    this.getApplicationContext(), DisplayActivity.class);
    
    clickIndentUpdate1.setAction("foobar" + String.valueOf(widgetId)); //NEW LINE
    

    The action string itself does not matter, you just need each appwidget’s intent to have a unique string, so that the intents are not combined.

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

Sidebar

Related Questions

I have a list view full of items that contain multiple widgets each such
i have a screen with multiple little widgets (all with different divs around them).
I have multiple ajax requests with javascript code as response, and I need to
I'm building the back end to a site which will have multiple widgets on
I have widgets/portlets similar to <div id=100 class=portlets> <iframe src=widgets/widget1_iframe.html></iframe> </div> Within each iFrame
I have multiple QLineEdit widgets on a configuration widget. When the configuration text is
I have multiple projects which are to be hosted together in a Tomcat container,
I have multiple UpdatePanels on a webpage, one inside UserControl (Purple ColorBox as show
I have multiple forms for lots of products on my page and want to
I have multiple input fields on my page. I Regex them with a css

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.