title: Sending a web request from Android and to retrieve back response from web application
body: <p>I would like to seek help in sending web request.</p>
  
  <p>In part 1, I have to detect for certain text/code in sms, that is done.</p>
  
  <p>Now I would like to know when the text/code (string) is being detected, how does android sends a web request over to a java web application?</p>
  
  <p>Do I need to use the post and get method?</p>
  
  <p>Using: Eclipse Indigo 2.7, API 2.3.3</p>
  
  <p>Advices and any help would be appreciated =)</p>
  
  <p>Below are my existing codes:</p>
  
  <pre><code>// ---get the SMS message passed in---
  Bundle bundle = intent.getExtras();
  SmsMessage[] msgs = null;
  String str = "";
  
   if (bundle != null) // if contains message
   {
  
   // ---retrieve the SMS message received---
   Object[] pdus = (Object[]) bundle.get("pdus");
   msgs = new SmsMessage[pdus.length];
   for (int i = 0; i &lt; msgs.length; i++)
  
     {
      msgs[i] = SmsMessage.createFromPdu((byte[]) pdus[i]);
      str += "SMS from " + msgs[i].getOriginatingAddress();
      str += " :";
            str += msgs[i].getMessageBody().toString();
      str += "\n";
  
     Log.i(TAG, "Message: "+msgs[i].getMessageBody().toString()); //The message content
  
  
      // Checking for Pattern
      // Direct use of Pattern:
      Pattern p = Pattern.compile("123");
      Matcher m = p.matcher(msgs[i].getMessageBody().toString());
  
  
      while (m.find()) // Find each match in turn; String can't do this.
            { 
               String result = m.group(); // Access a submatch group;
               Log.i(TAG, "Password Match: " + result);   //Showing the result
               str +="found";
            }
             } 
  
   // ---display the new SMS message---
   Toast.makeText(context, str, Toast.LENGTH_SHORT).show();
   }
  </code></pre>