本文是“Windows Phone 7 开发 31 日谈”系列的第25日。

昨天我写了如何在你的应用程序中嵌入字体,视频和图片。今天,我们来讨论从Web Service中获取数据,并将它们填入到你的应用程序中。

介绍Twitter API

    如果你之前没有玩儿过这个,那你肯定会常听我将一个Twitter应用程序比喻为“Hello, world!”程序。原因很简单,因为几乎每一个应用程序都需要连接Web Service,Twitter的API用起来非常简单,并且是免费的,不需要任何注册。换句话说,你可以无障碍地介入,这是学习新技术的一种好方法。

    有关Twitter API的关键内容可以在这里找到:http://dev.twitter.com/。我们来看看用户时间线元素的API,利用这个指定的URL模板:http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=jeffblankenburg。这里的用户名,jeffblankenburg ,可以用任意的Twitter用户名替换。如果点击我给你提供的URL,你会看到很多XML文档。这个文档包含了我最近的Twitter信息,以及大量的元数据。以下是这个文档中的一个节点:

<status>
  
<created_at>Sun Oct 24 13:30:04 +0000 2010</created_at>
  
<id>28594986565</id>
  
<text>Day #24: Embedding Fonts in Windows Phone 7 http://bit.ly/wp7day24 #wp7 #wp7dev #31daysofwp7</text>
  
<source>
    
<href="http://www.tweetdeck.com" rel="nofollow">TweetDeck</a>
  
</source>
  
<truncated>false</truncated>
  
<favorited>false</favorited>
  
<in_reply_to_status_id />
  
<in_reply_to_user_id />
  
<in_reply_to_screen_name />
  
<retweet_count />
  
<retweeted>false</retweeted>
  
<user>
    
<id>5688882</id>
    
<name>Jeff Blankenburg</name>
    
<screen_name>jeffblankenburg</screen_name>
    
<location>Columbus, OH</location>
    
<description>I'm a passionate technologist, husband, and father in Columbus, OH. I work for a small software company located in Redmond, WA. #wp7 http://blankensoft.com</description>
    
<profile_image_url>http://a3.twimg.com/profile_images/396764567/jeffblankenburgheadshot_normal.jpg</profile_image_url>
    
<url>http://www.jeffblankenburg.com</url>
    
<protected>false</protected>
    
<followers_count>1962</followers_count>
    
<profile_background_color>131516</profile_background_color>
    
<profile_text_color>333333</profile_text_color>
    
<profile_link_color>994700</profile_link_color>
    
<profile_sidebar_fill_color>cccccc</profile_sidebar_fill_color>
    
<profile_sidebar_border_color>999999</profile_sidebar_border_color>
    
<friends_count>652</friends_count>
    
<created_at>Tue May 01 15:54:53 +0000 2007</created_at>
    
<favourites_count>201</favourites_count>
    
<utc_offset>-18000</utc_offset>
    
<time_zone>Eastern Time (US & Canada)</time_zone>
    
<profile_background_image_url>http://s.twimg.com/a/1287010001/images/themes/theme14/bg.gif</profile_background_image_url>
    
<profile_background_tile>true</profile_background_tile>
    
<profile_use_background_image>true</profile_use_background_image>
    
<notifications>false</notifications>
    
<geo_enabled>true</geo_enabled>
    
<verified>false</verified>
    
<following>true</following>
    
<statuses_count>5664</statuses_count>
    
<lang>en</lang>
    
<contributors_enabled>false</contributors_enabled>
    
<follow_request_sent>false</follow_request_sent>
    
<listed_count>151</listed_count>
    
<show_all_inline_media>false</show_all_inline_media>
  
</user>
  
<geo />
  
<coordinates />
  
<place />
  
<contributors />
</status>

相关文章:

  • 2021-06-04
  • 2021-11-07
  • 2021-10-29
  • 2022-01-10
猜你喜欢
  • 2021-08-06
  • 2021-05-28
  • 2021-07-25
  • 2021-12-01
相关资源
相似解决方案