1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
DefaultHttpClient client = new DefaultHttpClient();
         
         Log.i(getClass().getName(), "One is complete");
         HttpPost post = new HttpPost("http://192.168.1.101:3000/authenticate");
         final List<BasicNameValuePair> nvp = new ArrayList<BasicNameValuePair>();
         nvp.add(new BasicNameValuePair("username", txtLogin.getText().toString()));
         nvp.add(new BasicNameValuePair("password", txtPassword.getText().toString()));
         final UrlEncodedFormEntity entity = new UrlEncodedFormEntity(nvp);
         post.setEntity(entity); 
         
         Log.i("Psot", "Two is fine");
         HttpResponse reponse = client.execute(post);
         BufferedReader br = new BufferedReader(new InputStreamReader(reponse.getEntity().getContent()));
         StringBuffer sb = new StringBuffer("");
         String line = "";
         while((line = br.readLine()) != null)
         {
          sb.append(line);
         }
         String result = sb.toString();
         
         Log.i("REsponse", "Third is working");
         rand.setText(result.toString());