Question: I want to store queues in a queue structure from the `stl` library. For some reasons I have to store a queue in each iteration of my program, but I think that create a new queue over and over again is too expensive.

I only know two ways to do this. The first one:

```
#include <iostream>
#include <deque>
using namespace std;
int main () {
    unsigned int limit, i = 0;
    deque<deque<int> > container;
    cin >> limit;
    for ( ; i < limit; i++ ) {
        deque<int> values;
        //set some values in the values structure.
        setValues(values, i);
        container.push(values);
    }
}

```

the second one:

```
#include <iostream>
#include <deque>
using namespace std;
int main () {
    unsigned int limit, i = 0;
    deque<deque<int> > container;
    deque<int> values;
    cin >> limit;
    for ( ; i < limit; i++ ) {
        //reset the structure, i.e. delete al the previous values.
        reset(values);
        //set some values in the values structure.
        setValues(values, i);
        container.push(values);
    }
}

```

the problem here is that I don't know any function for reset my queue, or maybe I have to do `values=NULL`?

How can I do this in an efficient way?

Thanks! :D

Answer: 
You're android:configure element must refer to an activity that will allow configuration of your widget. This activity must set result to RESULT\_OK, otherwise configuration is cancelled and widget is removed.

I suppose referring to your widget provider, not an activity, has the same effect of returning RESULT\_CANCEL from the configuration activity.

If you don't have a configuration activity, simply remove this entry and the widget will be added without trying to open such.
Another possibility other than 3c71's answer is that you might have forgotten to use the two-parameter version of `setResult(int resultCode, Intent data)`. The `data` parameter has to include an EXTRA which identifies the widget ID. 

```
Intent intent = new Intent();
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId);
setResult(RESULT_OK, intent);
sendBroadcast(intent);

```

The widget ID is provided to the configuration activity as an EXTRA in the Intent that is supplied to the activity when it is called. Retrieve it and store it like this:

```
mAppWidgetId = getIntent().getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,     AppWidgetManager.INVALID_APPWIDGET_ID);

```