2012年3月22日
摘要: 这一个要介绍的是在MapActivity上添加图钉。在Android的SDK中有详细的介绍,见以下内容。Google Map ViewUsing the Google Maps library, you can create your own map-viewing Activity. In this tutorial, you'll create a simple map application in two parts. In Part 1, you'll create an app that shows a map the user can pan and zoom. I 阅读全文
posted @ 2012-03-22 15:09 lee0oo0 阅读(882) 评论(0) 推荐(0) 编辑
摘要: 1. 这是Json数据,String str = "[{\"name\":\"Michael\",\"age\":20},{\"name\":\"Mike\",\"age\":21}]"。这个Json数据有一个数组,数组里面有两个Json对象 2. 首先必须生成Type对象,使用以下的方式(User是上一节的User类): Type listType = new TypeToken<LinkedList<User>>(){}.get 阅读全文
posted @ 2012-03-22 11:15 lee0oo0 阅读(733) 评论(0) 推荐(0) 编辑
摘要: ***这个例子只能是针对于Json对象而不是Json数组,Json数组需要转为为Json对象,这是下一节的事情。 1. 先有一个JSON对象String str = "{\"name\":\"Michael\",\"age\":20}",JSON类可以直接把JSON数据转化为java对象 2. 创建User类 public class User{ private String name; private int age; public void setName(String name){ this.name = n 阅读全文
posted @ 2012-03-22 10:39 lee0oo0 阅读(745) 评论(0) 推荐(0) 编辑
摘要: 使用SAX事件驱动模型解析xml数据: sax的工作原理简单地说就是对文档进行顺序扫描,当扫描到文档(document)开始与结束、元素(element)开始与结束、文档(document)结束等地方时通知事件处理函数,由事件处理函数做相应动作,然后继续同样的扫描,直至文档结束。以下是创建SAX解析的步骤: 1. 创建SAXParserFactory对象 SAXParserFactory factory = SAXParserFactory.newInstance(); 2. 创建SAXReader对象 SAXReader reader =factory.newwSAXPar... 阅读全文
posted @ 2012-03-22 10:09 lee0oo0 阅读(542) 评论(0) 推荐(0) 编辑
摘要: //Google参考文档,帮助我们怎样申请一个Google Map Key及其相关内容 code.google.com/android/add-ons/google-apis/mapkey.html //xml文件 <com.google.android.maps.MapView android:layout_height="fill_parent" android:layout_weight="fill_parent" android:enable="true" android:clickable="true&quo 阅读全文
posted @ 2012-03-22 01:42 lee0oo0 阅读(221) 评论(0) 推荐(0) 编辑
摘要: 申请Google Map API Key首先检查C:\DocumentsandSettings\Administrator\.android下面是否有debug.keystore,如没有则在eclispe下新建一个以GoogleAPIs为BuildTarge的项目,则该文件会生成。1、在命令行下输入:keytool-list-aliasandroiddebugkey-keystore "<debug.keystore文件路径>" -storepassandroid-keypassandroid如:Win7keytool-list-aliasandroiddebu 阅读全文
posted @ 2012-03-22 01:29 lee0oo0 阅读(687) 评论(0) 推荐(0) 编辑
摘要: Google提供的有关天气预报的Web服务的地址: 1. 根据经纬度得到数据 http://www.google.com/ig/api?hl=zh-cn&weather=,,,30670000,10409996 2. 根据城市名字得到数据 http://www.google.com/ig/api?hl=zh-cn&weather=guangzhou 阅读全文
posted @ 2012-03-22 01:04 lee0oo0 阅读(828) 评论(0) 推荐(0) 编辑
摘要: www.json.org这是JSON的官方网站。 首先,我,我们需要在code.google.com/p/google-gson/downloads/list下载JSON的jar包,解析后把gson-1.6.jar文件导入到你那个需要解析的项目中去。 解析JSON例子,如下: 1、 这是Json数据,"[{\"name\":\"Michael\",\"age\":20},{\"name\":\"Mike\",\"age\":21}]" 2、 //创建Jso 阅读全文
posted @ 2012-03-22 00:52 lee0oo0 阅读(7411) 评论(2) 推荐(0) 编辑