读书人

google天气预报SAX解析版(惟独当天的

发布时间: 2012-09-06 10:37:01 作者: rapoo

google天气预报SAX解析版(只有当天的天气)

废话不多说,直接上代码,代码里面注释很详细,不过之前一定要使用权限,

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />这两个权限不是必须的,但是为了以防万一,我一般都写上。

<uses-permission android:name="android.permission.INTERNET" />一定要写上,只要需要联网,都需要写上他,我的博客里面有一份权限大全,有兴趣的可以看看,

android上的权限很严格,使用特定功能必须使用特定的权限。其实,要是都写上不知道是什么结果,我也没有试过。哈哈哈

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    android:orientation="vertical" >    <Button        android:id="@+id/submit"        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:text="点击" />    <ImageView        android:id="@+id/iconofwheather"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:text="@string/hello" />    <TextView        android:id="@+id/condition"        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:text="@string/hello" />    <TextView        android:id="@+id/temperature"        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:text="@string/hello" />    <TextView        android:id="@+id/humidity"        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:text="@string/hello" /></LinearLayout>



以上是全部的代码,有啥不明白的,我们可以探讨一下。我们互相学习,共同进步。过两天会把xmlPull解析,DOM解析等其他三种解析方式贴出来。

读书人网 >移动开发

热点推荐