title: Toggle airplane mode in Android
body: <p>Did I make a mistake? It's not working.</p>
  
  <pre><code>public void airplane() {
      boolean isEnabled = Settings.System.getInt(this.getApplicationContext().getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) == 1;
      Settings.System.putInt(context.getContentResolver(),Settings.System.AIRPLANE_MODE_ON,isEnabled ? 0 : 1);
      //Settings.System.putInt(this.getApplicationContext().getContentResolver(),Settings.System.AIRPLANE_MODE_ON,isEnabled ? 0 : 1);
      Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
  }
  </code></pre>