Hey Prabhat..
here is code for reading data from URL,, u can test it just pass url.. it
will return all data. on that url.
------------------------------------------------------------------------------------------------
public String requestURLData(String uri)
{
String result=null;
InputStream input_stream=null;
BufferedReader buffered_stream=null;
URLConnection connection_object=null;
try
{
//construct url
URL url_object = new URL(uri);
// Open Connection for url
connection_object = url_object.openConnection();
//connect
connection_object.connect();
input_stream = connection_object.getInputStream();
// Reader rd=new Reader(input_stream);
// Buffered is always good for a performance plus.
buffered_stream = new BufferedReader(new
InputStreamReader(input_stream));
result=buffered_stream.readLine();
}
catch(Exception e){e.printStackTrace();}
finally
{
try
{
//close streams
buffered_stream.close();
input_stream.close();
} catch(Exception e)
{ e.printStackTrace();}
}
return result;
}
--------------------------------------------------------------------------------------------------------
Cheers,
Ravi Savaliya
On Wed, Sep 3, 2008 at 10:36 AM, PRABHAT KUMAR <
[EMAIL PROTECTED]> wrote:
> Hi Friends,
>
> I am new to android ............ I am not able to understand how
> to fetch data from a site using API..............
>
> Can anyone of you mail me a sample code ................... I am using
> Eclipse with android plugin
>
>
>
> --
> Thanks & Regards
> --
> Prabhat Kumar
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---