public String get_DAtaFromWeb(String url_toconnect)//throws Exception
{
int connection_Timeout = 10000;// 10sec
HttpParams my_httpParams = new BasicHttpParams();;
HttpConnectionParams.setConnectionTimeout(my_httpParams,connection_Timeout);
HttpConnectionParams.setSoTimeout(my_httpParams,connection_Timeout);
HttpClient httpclient = new DefaultHttpClient(my_httpParams); //get
http client with given params
String responseBody = null;
try
{
HttpGet httpget = new HttpGet(url_Pls);
if(myDebug.debug_Log)Log.i("CONTENT GET","executing request " +
httpget.getURI());
// Create a response handler
ResponseHandler<String> responseHandler = new BasicResponseHandler();
responseBody = httpclient.execute(httpget, responseHandler);
}
catch(Exception e)
{
if(myDebug.debug_Log)Log.i("Exception","Http Connection"+e.toString());
}
String Content = responseBody;
if(myDebug.debug_Log)Log.i("","-------------START---------------------------");
if(myDebug.debug_Log)Log.i("Response",""+Content);
if(myDebug.debug_Log)Log.i("","---------------END-------------------------");
return Content;
}
On Mon, Mar 9, 2009 at 4:53 PM, murphy <[email protected]> wrote:
>
> Hi all,
>
> Was just wondering if anyone had any code samples about writing and
> retrieving data from a website? I am currently creating an application
> which populates its textviews by accessing information from an online
> source.
>
> Thanks, Murphy.
>
> >
>
--
Dilli Rao. M
--~--~---------~--~----~------------~-------~--~----~
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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---