If you run the call in a separate thread it will work.

On Aug 27, 9:51 pm, androidETuser <[EMAIL PROTECTED]> wrote:
> I am trying to make HTTP requests thru android APis. But I am getting
> some error.
>
> Did any one saw this error before? Can someone help me out here?
>
> Here is the code I am running. This code executed when the sub
> activitilty is completed and the callback is called.
>
>     protected void onActivityResult(int requestCode, int resultCode,
> Intent intent) {
>         super.onActivityResult(requestCode, resultCode, intent);
>
>         Bundle extras = intent.getExtras();
>
>                String symbol = extras.getString("Symbol");
>
>               String lastPrc = getLastPrice(symbol);
>     }
>
>     private String getLastPrice (final String symbol) {
>         String  response = new String();
>         String errMsg = new String();
>         errMsg = "test";
>
>         try {
>
>                 AndroidHttpClient httpClient =
> AndroidHttpClient.newInstance("Etrade");
>
>                 HttpGet authGet = new HttpGet( 
> "https://us.etrade.com/e/t/invest/
> flash?type=EQ&sym=" + symbol);
>                 HttpResponse resp = httpClient.execute(authGet);
>                  response = resp.toString();
>             System.out.println("actual response is " + response);
>         } catch(Exception e) {
>                 errMsg = e.getMessage();
>
>                 System.out.println("actual error msg is " + errMsg);
>                 e.printStackTrace();
>         }
>         return response;
>     }
>
> This line is thrwoing errors.
>         httpClient.execute(authGet);
>
> And the error message is "This thread forbids HTTP requests".
>
> Thanks,
> Navin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to