title: Android: How to set "captive_portal_server","captive_portal_http_url","captive_portal_https_url" without use ADB?
body: <p>My android SDK is API:25</p>
  
  <p>I find an answer to set captive_portal_detection_enabled by use the code below.</p>
  
  <p>So that,I can escape the exclamation mark  if it's in a walled garden.</p>
  
  <pre><code> Settings.Global.putInt(MainActivity.this.getContentResolver(), "captive_portal_detection_enabled", 0);
  </code></pre>
  
  <p>Now, I want to change three value with the code as above :</p>
  
  <ol>
  <li>captive_portal_server</li>
  <li>captive_portal_http_url</li>
  <li>captive_portal_https_url</li>
  </ol>
  
  <p>I use</p>
  
  <pre><code> Settings.Global.putString(MainActivity.this.getContentResolver(), "captive_portal_server ", ServerList.get(position));
              Settings.Global.putString(MainActivity.this.getContentResolver(), "captive_portal_http_url  ", "http://"+ServerList.get(position)+"/generate_204");
              Settings.Global.putString(MainActivity.this.getContentResolver(), "captive_portal_https_url  ", "https://"+ServerList.get(position)+"/generate_204");
              Toast.makeText(MainActivity.this, "Captive portal server is now : " + server()
                                              +"\nCaptive portal http_url is now : "+http_url()
                                              +"\nCaptive portal https_url is now : "+https_url(), Toast.LENGTH_SHORT).show();
  </code></pre>
  
  <p>and I always get <strong>null</strong> of server(),http_url(),https_url().</p>
  
  <pre><code>    private String server(){
      return Settings.Global.getString(MainActivity.this.getContentResolver(), "captive_portal_server");
  }
  private String http_url(){
      return Settings.Global.getString(MainActivity.this.getContentResolver(), "captive_portal_http_url");
  }
  private String https_url(){
      return Settings.Global.getString(MainActivity.this.getContentResolver(), "captive_portal_https_url");
  }
  </code></pre>
  
  <p>Please help me to solve it !</p>
  
  <p>By the way!!! How do I check the url is server or not?!!!</p>