菜鸟学Android(二)Build a Blog Reader

教程地址:

http://teamtreehouse.com/library/build-a-blog-reader-android-app

跟着视频做了一遍,完了之后,感觉太多东西,一下子消化不了。只好从头再学一遍,理清思路。然后再照葫芦画瓢再自己做一个APP.

APP功能:

从博客网站读取博客标题,显示在APP标题列表中,用户点击标题后在APP中打开相应的文章。

5 Steps to build this simple App:

1.Exploring the Master-Detail Template

  简单讲解Android系统自带的Master-Detail模板,为后面的开发做准备。

2.Rebuilding from Scratch

  • 2.1 Creating the Project and ListActivity
  • 2.2 Handling a lack of data
  • 2.3 Adding data for the list
  • 2.4 All about @string Resources

从零白的ListActivity开始建构,MVC:Model-View-Control 模式。在没有数据可以显示的情况下,显示预设的信息。添加String Array 做为数据Model,采用dapter(Controller)处理数据,并显示在ListView(View)。

3.Getting Data from the Web :Send request to the web, then handle the response or error from the web and parse the response to strings, manipulate them and display them on the ListView.

  • 3.1 Trying Code and Catching Exceptions: try-Catch block.
  • 3.2 Request Data from the Web in Main Thread( the wrong way!)
  • 3.3 Request Data from the Web in AsyncTask
  • 3.4 Handle Error when the Network is down
  • 3.5 Getting JSON Data from an HTTP Request
  • 3.6 Parsing Data returned in JSON Format

4.Adapting Data for Display in a list : create an Adapter and setListView adapter

  • 4.1 Finish AsyncTask
  • 4.2 Filling String Array and Create the Adapter
  • 4.3 Using Dialog to handle Errors
  • 4.4 Clean up Presentation
  • 4.5 Add Second Data with a SimpleAdapter, HashMap

5.Using Intents to Display and Share Posts

  • 5.1 Open a Webpage in the Browser
  • 5.2 Open a Webpage wthin a new activity of the app
  • 5.3 Easy sharing with Intents
  • 5.4 Adding a differnt Icon for Older Menus

**花了两天时间重新做了一遍apk。想换成博客园的blog url,但是不知道url在哪里找。

**试了一下:https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=lynda

Json 数据有好几层,尝试着筛选导出数据未成功

原文地址:https://www.cnblogs.com/rockylearnstodevelop/p/3402185.html