title: android java GET request in new runnable
body: <p>I want to do GET request in new runnable (click button). I've find many totorials in internet (search &quot;variable in new runnable&quot;), but they don't work in my example. I want to do only request wthout handle  response</p>
  <pre><code>        url = &quot;http://.....&quot;
  
          button_check.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  secThread(url);
              }
          });
      }
  
       private  void  secThread(String url){
          class MycostomRunnable implements Runnable {
              String url;
              MycostomRunnable(String s ) {url = s;}
              @Override
              public void run() {
                  try {
                      insertCarinBase(url); // if print &quot;url&quot; it's empty
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
              }
          }
         Thread t = new Thread(new MycostomRunnable(url)); 
         t.start();
     
  }
      public void insertCarinBase(String urlserver) throws IOException {
          URL url = new URL(urlserver);
          HttpURLConnection connection = (HttpURLConnection) url.openConnection();
          connection.setRequestMethod(&quot;GET&quot;);
      }
  </code></pre>
  <p>If print variable &quot;url&quot; in &quot;try/catch&quot; block it is empty</p>