Hi, i'm trying to use a HttpClient to get the HTML/XML code from here:
http://spelradion.libsyn.com/rss/
I'm having problems with receiving the data. Here is the part of the
code that lies under this topic:
-------------------------------------------
http = new DefaultHttpClient();
get = new HttpGet("http://spelradion.libsyn.com/rss");
try
{
response = http.execute(get);
System.out.print(HttpHelper.request(response));
}
catch(Exception e)
{
alertb.setMessage("Kunde inte ansluta till Spelradion.");
alertb.show();
}
--------------------------------------------
And this is the implementation of HttpHelper:
---------------------------------------------
package se.eclaesson.spelradion.HttpHelper;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import org.apache.http.HttpResponse;
public class HttpHelper {
public static String request(HttpResponse response){
String result = "";
try{
InputStream in = response.getEntity().getContent();
BufferedReader reader = new BufferedReader(new
InputStreamReader(in));
StringBuilder str = new StringBuilder();
String line = null;
while((line = reader.readLine()) != null){
str.append(line + "\n");
}
in.close();
result = str.toString();
}catch(Exception ex){
result = "Error";
}
return result;
}
}
----------------------------------------------
I don't get the data from the webpage. Everything i get is "false".
Why are this happening? If there are any "simpler" way of accessing
code from a page, please tell me.
Thanks in advance.
Emanuel Claesson
--
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]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en