1. Check out our app, Forums for Android! Download and leave feedback here!

Widget opening wrong activity with wrong extras

Discussion in 'Application Development' started by marka971, May 29, 2010.

  1. marka971

    marka971 Member
    Thread Starter
    15

    Nov 15, 2009
    11
    0
    15
    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...