title: use string variable in place of ip address in url of android?
body: <p>I want to use string variable in place of ip address in url call.
  I want to make login with ip address and port number in application. then I want to save this ip address in shared preferences and then in url call i want to use that store ip address in shared preferences</p>
  
  <p>I get the ip address of shared preferences like this.</p>
  
  <pre><code>SharedPreferences pref = getActivity().getSharedPreferences("MyPref", MODE_PRIVATE);
  
  
      ip= pref.getString("key_ip", null);           // getting Float
  
      Log.e("ip: ", "&gt; " + ip);
  </code></pre>
  
  <p>Then i call the url using method like this.</p>
  
  <pre><code>public static String off33() {
          StringBuffer stringBuffer = new StringBuffer("");
          BufferedReader bufferedReader = null;
          try {
              HttpClient httpClient = new DefaultHttpClient();
              HttpGet httpGet = new HttpGet();
  
              URI uri = new URI("http://10.1.1.82:80/outlet?3=ON");
  
  
              httpGet.setURI(uri);
              httpGet.addHeader(BasicScheme.authenticate(
                      new UsernamePasswordCredentials("admin", "kirti123"),
                      HTTP.UTF_8, false));
  
              HttpResponse httpResponse = httpClient.execute(httpGet);
              InputStream inputStream = httpResponse.getEntity().getContent();
              bufferedReader = new BufferedReader(new InputStreamReader(
                      inputStream));
  
              String readLine = bufferedReader.readLine();
              while (readLine != null) {
                  stringBuffer.append(readLine);
                  stringBuffer.append("\n");
                  readLine = bufferedReader.readLine();
              }
          } catch (Exception e) {
              // TODO: handle exception
          } finally {
              if (bufferedReader != null) {
                  try {
                      bufferedReader.close();
                  } catch (IOException e) {
                      // TODO: handle exception
                  }
              }
          }
          return stringBuffer.toString();
      }
  </code></pre>
  
  <p>so, I want to use ip string in place of url in method 10.1.1.82 means i want to use like this.</p>
  
  <pre><code>            URI uri = new URI("http://ip:80/outlet?3=ON");
  </code></pre>
  
  <p>ip is a string variable and in this variable i get 10.1.1.82</p>
  
  <p>so how i cant use this?</p>