set airplanemode at a specific time
<pre><code>public class AirPlaneModeActivity extends Activity {

Button b;
TimePicker tp;
Calendar cal;
AlarmManager am ;
PendingIntent pi;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    b = (Button)findViewById(R.id.button1);
    tp = (TimePicker)findViewById(R.id.timePicker1);
    cal = Calendar.getInstance(Locale.getDefault());
    am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
    tp.setIs24HourView(true);        

    b.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            cal.set(Calendar.HOUR_OF_DAY,tp.getCurrentHour());
            cal.set(Calendar.MINUTE,tp.getCurrentMinute());
            cal.set(Calendar.SECOND,0);
        }
    }); 

    pi = PendingIntent.getBroadcast(this, 0, setAPM(), 0);       
    am.set(AlarmManager.RTC_WAKEUP,cal.getTimeInMillis(),pi);        

}
public Intent setAPM(){
    boolean isEnabled = Settings.System.getInt(
              getContentResolver(), 
              Settings.System.AIRPLANE_MODE_ON, 0) == 1;
    // toggle airplane mode
    Settings.System.putInt(getContentResolver(),
            Settings.System.AIRPLANE_MODE_ON, isEnabled ? 0 : 1);

    // Post an intent to reload
    Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
    intent.putExtra("state", !isEnabled);
    return intent;          
}
</code></pre>

<p>}</p>

<p>I want to change the airplanemode at the setted time, that i get from a timepicker. Than i set the time from the timepicker into a calender from witch i get the time for the alarmmanager.set Method but it doesn't do anything. i watch all over the internet but i didn found anything. I found this post on <a href="http://stackoverflow.com/questions/9136924/timed-airplane-mode-for-android">stackoverflow</a> but without answer
(Sorry for my bad english)
Thanks for your answers</p>
