First widget updates seconde widget
<p>If I have two widgets and I press on a button on the first one, the seconde widget updates hiszelf. That is not the intention :) When debugging I noticed that the first widget the widgetid of te second used for updating</p>

<pre><code>public class WidgetActivity extends AppWidgetProvider {
    public static WidgetActivity Widget = null;
    public static Context context;
    public static AppWidgetManager appWidgetManager;
    public static int appWidgetIds[];   
    public static String ACTION_OPEN_APP = "OpenApp";
    private static int appWidgetId;


    @Override
public void onUpdate( Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds )    {     
    if (null == context) context = WidgetActivity.context;
    if (null == appWidgetManager) appWidgetManager = WidgetActivity.appWidgetManager;
    if (null == appWidgetIds) appWidgetIds = WidgetActivity.appWidgetIds;

    WidgetActivity.Widget = this;
    WidgetActivity.context = context;
    WidgetActivity.appWidgetManager = appWidgetManager;
    WidgetActivity.appWidgetIds = appWidgetIds;

    final int N = appWidgetIds.length;
    for (int i=0; i&lt;N; i++) 
    {
        appWidgetId = appWidgetIds[i];  

        updateAppWidget(context,appWidgetManager, appWidgetId);            
    }

}


public void updateAppWidget(Context context, AppWidgetManager appWidgetManager,
        int appWidgetId) {

    RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget);

    Intent intent = new Intent(context, UpdateService.class);


    PendingIntent pendingIntent = PendingIntent.getService(context, 0, intent, 0);

    Intent configIntent = new Intent(context, Main.class);
    configIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
    PendingIntent configPendingIntent = PendingIntent.getActivity(context, 0, configIntent, 0);

    remoteViews.setOnClickPendingIntent(R.id.headlinesBox, configPendingIntent);

    remoteViews.setOnClickPendingIntent(R.id.WidgetRefresh_btn, pendingIntent);

    setHeadlines(appWidgetId);

    // Tell the widget manager
    appWidgetManager.updateAppWidget(appWidgetId, remoteViews);
}

public static void setHeadlines(int appWidgetId)
{
    RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget);

    ArrayList&lt;String&gt; newsItems = getRssItems("*****rss.php", appWidgetId); 

    if(newsItems.size() == 3)
    {
        remoteViews.setTextViewText(R.id.headline1, newsItems.get(0));
        remoteViews.setTextViewText(R.id.headline2, newsItems.get(1));
        remoteViews.setTextViewText(R.id.headline3, newsItems.get(2));
    }

    DateTime dateTime = new DateTime();
    CharSequence text = dateTime.getTime();
    remoteViews.setTextViewText(R.id.WidgetUpdateTime, text);
    remoteViews.setViewVisibility(R.id.progressWidget, View.GONE);
    remoteViews.setViewVisibility(R.id.WidgetRefresh_btn, View.VISIBLE);

    appWidgetManager.updateAppWidget(appWidgetId, remoteViews);
}



public static ArrayList&lt;String&gt; getRssItems(String feedUrl, int appWidgetId) 
{

}


public static class UpdateService extends Service {
    @Override
    public void onStart(Intent intent, int startId) {

        RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.widget);

        remoteViews.setViewVisibility(R.id.WidgetRefresh_btn, View.GONE);
        remoteViews.setViewVisibility(R.id.progressWidget, View.VISIBLE);


        appWidgetManager.updateAppWidget(appWidgetId, remoteViews);


    WidgetActivity.Widget.onUpdate(context, appWidgetManager, appWidgetIds);

    }

    @Override
    public IBinder onBind(Intent arg0) {
        return null;
    }
}   
</code></pre>

<p>}</p>
