Widget opening wrong activity with wrong extras


Last Updated:

  1. marka971

    marka971 Member This Topic's Starter

    Joined:
    Nov 15, 2009
    Messages:
    11
    Likes Received:
    0
    Hi,

    I have developed an app that enables the user to put several widgets of the same kind on the homescreen, but with different data in them depending on a setting in the widget conf activity. When the user clicks a widget, an activity should show up with data according to which instance of the widgets that was pressed. An activity is opened when I press a widget, but it doesn't seem to realize which widget was pressed. Any idea what could be wrong? This is how I set up the pending intent to open the activity:

    Code (Text):
    1.  
    2. Intent soldierDetailsIntent = new Intent(context, SoldierDetails.class);
    3. soldierDetailsIntent.putExtra(OpenSoldierDetailsIntent.EXTRA_WIDGETID, widgetId);
    4. soldierDetailsIntent.putExtra(OpenSoldierDetailsIntent.EXTRA_UID,soldier.getUID());
    5. PendingIntent pendingSoldierDetailsIntent = PendingIntent.getActivity(context, widgetId, soldierDetailsIntent,Intent.FLAG_ACTIVITY_NEW_TASK);
    6. views.setOnClickPendingIntent(R.id.WidgetTotalScore,
    7. pendingSoldierDetailsIntent);
    8.  
    Thanks
    Markus
     

    Advertisement

Share This Page

Loading...