how to updatePeriod for widgets based in a selection from a spinner programmatically?
<p>I'm using the following code to select the time from the spinner but Im unable to update it for widget </p>

<p>adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
     spinner2.setAdapter(adapter);
     spinner2.setOnItemSelectedListener(
             new OnItemSelectedListener() {</p>

<pre><code>             public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1,
                      int arg2, long arg3) {
                    int index = arg0.getSelectedItemPosition();
                    Toast.makeText(getBaseContext(),
                        "You have selected item : " + vals[index],
                        Toast.LENGTH_SHORT).show();
                  }

             {


             }
</code></pre>

<p>//vals[index] contains the time period selected from the spinner </p>

<p>//im using the following code to update the widget time but in unable to make it </p>

<p>final Intent intent = new Intent(context, UpdateWidgetService.class);
   final PendingIntent pending = PendingIntent.getService(context, 0, intent, 0);
    final AlarmManager alarm = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
    alarm.cancel(pending);
    long interval = 1000*60;
   alarm.setRepeating(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime(),interval, null);</p>
