title: Cannot get back from wifi configuration page
body: <p>I develop a very simple application that connects to a wifi network and then does some stuff.</p>
  
  <p>The idea is that i open the wifi configuration page to select a wifi network.</p>
  
  <p>Until here I'm doing fine But then when i press the back button to go back to my application it reloads the wifi configuration page.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>public class SetHttp extends Activity {
      public final static String EXTRA_MESSAGE = "com.example.WebcamView.MESSAGE";
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_set_http);
          WifiManager mWifi = (WifiManager)getSystemService(Context.WIFI_SERVICE);
          if(!mWifi.isWifiEnabled()){
              mWifi.setWifiEnabled(true);
          }
          sendIntent();
      }
  
      protected void sendIntent(){
          Intent enwifi = new Intent(android.provider.Settings.ACTION_WIFI_SETTINGS);
          startActivityForResult(enwifi, 3);
      }
  
      public void sendHttp(View view){
          Intent intent = new Intent(this, WebPage.class);
          EditText editText = (EditText) findViewById(R.id.edit_message);
          String message = editText.getText().toString();
          intent.putExtra(EXTRA_MESSAGE, message);
           startActivity(intent);
      }
  }
  </code></pre>
  
  <p>I have tried to create the onStart, onRestart... methods but the application crashes.</p>
  
  <p>Any ideas ? Should Use startActivityForResult and onActivity Result and what should i write in on ActivityResult ?? </p>
  
  <p>Thank you very much!!</p>
  
  <p>I have tried some things but none of them is working. Here is my code:</p>
  
  <pre><code>public class SetHttp extends Activity {
  public final static String EXTRA_MESSAGE = "com.example.WebcamView.MESSAGE";
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_set_http);
      WifiManager mWifi = (WifiManager)getSystemService(Context.WIFI_SERVICE);
      if(!mWifi.isWifiEnabled()){
          mWifi.setWifiEnabled(true);
      }
      //sendIntent();
  }
  protected void onStart(){
      super.onStart();
      //sendIntent();
  }
  protected void onRestart(){
      super.onRestart();
      //sendIntent();
      setContentView(R.layout.activity_set_http);
  }
  protected void onPause(){
      super.onPause();
      setContentView(R.layout.activity_set_http);
  }
  protected void onStop(){
      super.onStop();
  }
  protected void onResume(Bundle savedInstanceState){
      super.onResume();
      setContentView(R.layout.activity_set_http);
      sendIntent();
  }
  
  protected void sendIntent(){
      Intent enwifi = new Intent(android.provider.Settings.ACTION_WIFI_SETTINGS);
      startActivity(enwifi);
  }
  
  public void sendHttp(View view){
      Intent intent = new Intent(this, WebPage.class);
      EditText editText = (EditText) findViewById(R.id.edit_message);
      String message = editText.getText().toString();
      intent.putExtra(EXTRA_MESSAGE, message);
       startActivity(intent);
  }
  </code></pre>
  
  <p>}</p>