您的位置:首页 > 移动开发 > Android开发

Android 博客园客户端 (五) 查看评论、搜索博主

2014-09-11 15:44 211 查看
项目地址:https://github.com/ZhangTingkuo/AndroidCnblogs

1.查看评论



// 获取文章评论
public static final String BLOGS_COMMENTS = "http://wcf.open.cnblogs.com/blog/post/{POSTID}/comments/{PAGEINDEX}/{PAGESIZE}";
// 获取新闻评论
public static final String NEWS_COMMENTS = http://wcf.open.cnblogs.com/news/item/{CONTENTID}/comments/{PAGEINDEX}/{PAGESIZE};


<entry>
<id>2651327</id>
<title type="text"/>
<published>2013-04-07T18:06:24+08:00</published>
<updated>2014-09-10T15:14:10Z</updated>
<author>
<name>松下裤腰带</name>
<uri>http://home.cnblogs.com/u/360988/</uri>
</author>
<content type="text">这好蛋疼呀。。。</content>
</entry>

<entry>
<id>2652650</id>
<title type="text"/>
<published>2013-04-09T09:56:48+08:00</published>
<updated>2014-09-10T15:14:10Z</updated>
<author>
<name>john23.net</name>
<uri>http://home.cnblogs.com/u/64521/</uri>
</author>
<content type="text">感谢分享</content>
</entry>


2.搜索博主

搜索博主,如果输入中文的话,需要进行转码.英文的话,转码前后没有区别。

http://wcf.open.cnblogs.com/blog/bloggers/search?t={TERM} 若。只如初见 http://wcf.open.cnblogs.com/blog/bloggers/search?t=%E8%8B%A5%E3%80%82%E5%8F%AA%E5%A6%82%E5%88%9D%E8%A7%81[/code] 
try {
authorName = URLEncoder.encode(authorName, "utf-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
path = path.replace("{TERM}", authorName);


XML的格式跟推荐博主的XML格式相同,所以不需要再重新写Handler和Adapter.直接使用之前的就可以

<entry>
<id>http://www.cnblogs.com/jillzhang/</id>
<title type="text">Robin Zhang</title>
<updated>2012-04-04T19:30:55+08:00</updated>
<link rel="alternate" href="http://www.cnblogs.com/jillzhang/"/>
<blogapp>jillzhang</blogapp>
<avatar>http://pic.cnblogs.com/face/12311/20140902133806.png</avatar>
<postcount>290</postcount>
</entry>

<entry>
<id>http://www.cnblogs.com/JimmyZhang/</id>
<title type="text">Jimmy Zhang</title>
<updated>2014-09-10T11:15:32+08:00</updated>
<link rel="alternate" href="http://www.cnblogs.com/JimmyZhang/"/>
<blogapp>JimmyZhang</blogapp>
<avatar>http://pic.cnblogs.com/face/u24804.jpg?id=30073100</avatar>
<postcount>83</postcount>
</entry>


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐