//本来准备通过查找城市id后再通过id查找天气信息免去建立数据库的麻烦,但是api不稳定,只能通过建立id数据库来对应查找了
super.onCreate(savedInstanceState);
String str = "http://toy.weather.com.cn/SearchBox/searchBox?"
+ "callback=jsonp1342857491709&_=1342857620727&language=zh&keyword=guilin";
try {
URL url = new URL(str);
HttpURLConnection cn = (HttpURLConnection) url.openConnection();
cn.setConnectTimeout(5 * 1000);
cn.setRequestMethod("GET");
System.out.println("stream=======" + cn.getInputStream());
InputStreamReader in = new InputStreamReader(cn.getInputStream());
System.out.println("in======" + in);
BufferedReader bu = new BufferedReader(in);
String line = bu.readLine().toString();
System.out.println("ling=====" + line);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}