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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:25:23+00:00 2026-06-07T06:25:23+00:00

I have an appwidget which uses ListView . I have created a class that

  • 0

I have an appwidget which uses ListView.
I have created a class that extends RemoteViewsService:

public class AppWidgetService extends RemoteViewsService {
    @Override
    public RemoteViewsFactory onGetViewFactory(Intent intent) {
        return (new AppWidgetListFactory(this.getApplicationContext(), intent));
    }
}

In my AppWidgetProvider, I call the following method for each instance of the widget (for each appWidgetId):

private static void fillInList(RemoteViews widget, Context context, int appWidgetId) {
    Intent intent = new Intent(context, AppWidgetService.class);
    intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
    widget.setRemoteAdapter(R.id.appwidget_listview, intent);
}

The constructor of the AppWidgetListFactory

public AppWidgetListFactory(Context context, Intent intent) {
    this.context = context;
    appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);

    System.out.println("New TVAPWLF for: " + appWidgetId);
    trains = WidgetData.getInstance().widgetMap.get(appWidgetId);
}

Now the problem is, that the fillInList method gets called just as often as there are instances of the widget, but the onGetViewFactory method only gets called once. This results in all the widgets showing the same data.

How can I fix this?

  • 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-07T06:25:25+00:00Added an answer on June 7, 2026 at 6:25 am

    I haven’t tested this myself, but looking at the source code for RemoteViewsService.onBind(), I believe you can not just vary the extras in your Intent in order for it to detect that a new call to your onGetViewFactory() method is needed since it uses the Intent.filterEquals() method for the comparison:

    Determine if two intents are the same for the purposes of intent resolution (filtering). That is, if their action, data, type, class, and categories are the same. This does not compare any extra data included in the intents.

    I would suggest passing the information that you need (widget id?) through the Intent’s data instead, maybe something like:

    private static void fillInList(RemoteViews widget, Context context, int appWidgetId) {
        Intent intent = new Intent(context, AppWidgetService.class);
        intent.setData(Uri.fromParts("content", String.valueOf(appWidgetId), null));
        widget.setRemoteAdapter(R.id.appwidget_listview, intent);
    }
    

    and respectively on the receiving side:

    public TreinVerkeerAppWidgetListFactory(Context context, Intent intent) {
        this.context = context;
        appWidgetId = Integer.valueOf(intent.getData().getSchemeSpecificPart());
    
        System.out.println("New TVAPWLF for: " + appWidgetId);
        trains = WidgetData.getInstance().widgetMap.get(appWidgetId);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created an AppWidget for Honeycomb which is working well, except that when
I have a appwidget extends from appwidgetprovider. I have created a layout xml file
I am developing an appwidget that uses the RemoteViews to display a ListView. For
I have a Button on appwidget, that I need to 'enable'/'disable' programmatically from a
I have created an App Widget for Android 1.5. It uses a TextView to
I'm creating both an appWidget container and appWidgets. I have a problem which I
i have an app widget, which contains only one imageview. i redraw that image
I have an app widget project, which relies that a corresponding app is installed.
I have a C++ application that can be simplified to something like this: class
i am making an appwidget and i have problems with click event, which is

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.