title: How to use HTTP-GET connect with input username and password for access API
body: <p>I use API for connect information but I can't to get data from this API because I don' know How to use HTTP get connect with input username and password for access this data.</p>
  
  <p>Main </p>
  
  <pre><code>String url = "http://flightxml.flightaware.com/json/FlightXML2/";
      @SuppressLint("NewApi")
      @Override
      protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      StrictMode.ThreadPolicy policy = new StrictMode.
      ThreadPolicy.Builder().permitAll().build();
      StrictMode.setThreadPolicy(policy); 
  
      TextView txt1 = (TextView)findViewById(R.id.textView1);
  
      String result  = HttpGet(url);
      txt1.setText(result);
                     }
      // Connect Http Get //
      public String HttpGet(String url) {
      StringBuilder builder = new StringBuilder();
      HttpClient client = new DefaultHttpClient();
      HttpGet httpGet = new HttpGet(url);
  
      try {
      HttpResponse response = client.execute(httpGet);
      StatusLine statusLine = response.getStatusLine();
      int statusCode = statusLine.getStatusCode();
      if (statusCode == 200) { // Status OK
      HttpEntity entity = response.getEntity();
      InputStream content = entity.getContent();
      BufferedReader reader = new BufferedReader(new InputStreamReader(content));
      String line;
      while ((line = reader.readLine()) != null) {
      builder.append(line);}
      } else {
      Log.e("Log", "Failed to download result..");
      }
      } catch (ClientProtocolException e) {
      e.printStackTrace();
      } catch (IOException e) {
      e.printStackTrace();
      }
      return builder.toString(); }}
  </code></pre>
  
  <p>In browser I can input username and password but in Android App I don't know How to input. same this pic.</p>
  
  <p><a href="http://i.stack.imgur.com/63EBI.jpg" rel="nofollow">http://i.stack.imgur.com/63EBI.jpg</a></p>