title: Login and get source code
body: <p>I'm trying to login to a website and show it's source code using android emulator but I can't make it work but in java based only, it's working. </p>
  
  <p>Here's my code:</p>
  
  <pre><code>package auth.test;
  
  import android.app.Activity;
  import android.os.Bundle;
  // used for interacting with user interface
  import android.widget.TextView;
  import android.widget.EditText;
  // used for passing data 
  // used for connectivity
  import java.io.BufferedReader;
  import java.io.BufferedWriter;
  import java.io.InputStreamReader;
  import java.io.OutputStreamWriter;
  import java.net.MalformedURLException;
  import java.net.URL;
  import java.net.URLConnection;
  
  public class AuthActivity extends Activity {
  /** Called when the activity is first created. */
  
  //Handler h;
  private static URL URLObj;
  private static URLConnection connect;
  EditText eText;
  TextView tView;
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
     tView=(TextView)findViewById(R.id.textView1);
     initControls();
  }
  
      public void initControls()
      {
  
          try {
  
              URLObj = new URL("http://students.usls.edu.ph");
              connect = URLObj.openConnection();
              connect.setDoOutput(true);  
          }
          catch (MalformedURLException ex) {
              tView.setText("The URL specified was unable to be parsed or uses an invalid protocol. Please try again.");
              //System.exit(1); 
          }
          catch (Exception ex) {
              tView.setText("An exception occurred. " + ex.getMessage());
              //System.exit(1);
          }
  
  
          try {
  
              BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(connect.getOutputStream()));
              writer.write("username=0920204&amp;password=******");
              //writer.close();
  
  
              BufferedReader reader = new BufferedReader(new InputStreamReader(connect.getInputStream()));
  
              String lineRead="";
  
  
              while((lineRead=reader.readLine())!=null)
              {
                  tView.append(lineRead + "\n");
              }
  
  
              reader.close();
  
          }
          catch (Exception ex) {
              tView.setText("There was an error reading or writing to the URL: " + ex.getMessage());
          }
      }
  }
  </code></pre>
  
  <p>So, instead of showing the source code of the main page, it's showing the source code of the login page. So I think there's something wrong with the Bufferedwriter part of the code. </p>