Android development example-Application of admission to colleges and universities (1), android Colleges and Universities

Source: Internet
Author: User

Android development example-Application of admission to colleges and universities (1), android Colleges and Universities

This series of articles provides a simple Android Application Development example method. The steps are as follows:

1. Obtain the data source required by the application

Data sources generally come from the Internet, personal data collection, or other methods.

2. Application uidesign

Each application requires a simple UI design sketch for developers to better implement coding.

3. Application Implementation

Complete Android applications

It is hereby stated that the data sources in this series of articles are obtained through the Internet, and are only used as an example.


The application introduction provides the number-of-each-row admission query function of each university, which serves as a reference for students to fill in their volunteers.
1. Search for the data source 1. First open Baidu and enter "admission scores for colleges and universities" to search for the data source that meets your application requirements from the result list. Here we select the first data: scores of each province and city for the college entrance examination _ Sina college entrance examination 2 click to enter, we found that a separate College score line query box is provided in the middle
3 click search to enter the university score line separate query interface, and get to the link we want to find data http://kaoshi.edu.sina.com.cn/collegedb/index.php? _ Action = more & show = more_score & provid = & wl = 1 & collegeid = 10001

2. analyze the data source through a browser. If you need more complex analysis, you can use the commonly used packet capture software. 1. Press F12 to open the browser's packet capture interface. chrome is in the netword column, and IE is enabled in the network bar. 2 open the first step through the browser to get the link http://kaoshi.edu.sina.com.cn/collegedb/index.php? _ Action = more & show = more_score & provid = & wl = 1 & collegeid = 10001. The packet capture information is as follows:
3. Through the Link interface, we know that the query conditions include province information, school information, and selection conditions of the liberal arts and sciences. 3-1 province information retrieval through Html analysis, we found that the province information already exists on the webpage, as shown below:
<Select id = "provinceSelect"> <option value = "1" label = "Beijing"> Beijing </option> <option value = "2" label = "Tianjin"> Tianjin </option> <option value = "3" label = "Shanghai"> Shanghai </option> <option value = "4" label = "Chongqing"> Chongqing </option> <option value = "5" label = "Hebei"> Hebei </option> <option value = "6" label = "Henan"> Henan </option> <option value = "7" label = "Shandong"> Shandong </option> <option value = "8" label = "Shanxi"> Shanxi </option> <option value = "9" label = "Anhui"> Anhui </option> <option value = "10" label = "Jiangxi"> Jiangxi </option> <option value = "11" label = "Jiangsu"> Jiangsu </option> <option value = "12" label = "Zhejiang"> Zhejiang </option> <option value = "13" label = "Hubei"> Hubei </ option> <option value = "14" label = "Hunan"> Hunan </option> <option value = "15" label = "Guangdong"> Guangdong </option> <option value = "16" label = "Guangxi"> Guangxi </option> <option value = "17" label = "Yunnan"> Yunnan </option> <option value = "18 "label =" Guizhou "> Guizhou </option> <option value =" 19 "label =" Sichuan "> Sichuan </option> <option value =" 20 "label =" shaanxi "> Shaanxi </option> <option value =" 21 "label =" Qinghai "> Qinghai </option> <option value =" 22 "label =" Ningxia "> Ningxia </option> <option value = "23" label = "Heilongjiang"> Heilongjiang </option> <option value = "24" label = "Jilin"> Jilin </option> <option value = "25" label = "Liaoning"> Liaoning </option> <option value = "26" label = "Tibet"> Tibet </option> <option value = "27" label = "Xinjiang"> Xinjiang </option> <option value = "28" label = "Inner Mongolia"> Inner Mongolia </option> <option value = "29" label = "Hainan"> Hainan </option> <option value = "30" label = "Fujian"> Fujian </option> <option value = "31" label = "Gansu"> Gansu </option> <option value = "32" label = "Hong Kong, Macao and Taiwan"> Hong Kong, Macao and Taiwan </option> </select>
3-2 The selected information is consistent with the province information, which exists on the Html webpage.
<Select id = "wl"> <option value = "1" selected = "selected"> liberal arts </option> <option value = "2"> science </option> <option value = "3"> comprehensive </option> </select>
3-3 school information retrieval through analysis, we found that the school information does not exist and the Html webpage. We found the JavaScript code and found that the school information exists in Beijing University '; [1] indicates the province id. For details, see value in 3-1 province Information Acquisition. ['123'] indicates the school code. We copied the data to txt, in addition, we can convert the school information into the format of 1 #10001 # Peking University through Ctrl + F series replacement, which is easy for us to parse and use. The final storage format of school data is as follows: 1 #10001 # Peking University
1 #10002 # Renmin University of China
#1 #10003 # Tsinghua University
1 #10004 # Beijing Jiaotong University
3-4 get the link of the query result through the packet capture analysis, we get the actual query address: http://kaoshi.edu.sina.com.cn/iframe/ I _collegescore.php? _ Action = collegescore & provid = 1 & collegeid = 10001 & wl = 2 & num = 0

Among them, three important parameters: provid indicates the province ID, collegeid indicates the school ID, wl indicates the selection of literature and science.

3-5 Result Analysis

The returned result is in JSON format as follows:

[{"id":"14847","collegeid":"10001","provid":"19","syear":"2013","wl":"2","plan":"19","score_min":"0.00","score_avg":"678.00","score_td":"0.00","score_max":"694.00","batch":"11","batch_diff":"116"},{"id":"13183","collegeid":"10001","provid":"19","syear":"2012","wl":"2","plan":"14","score_min":"640.00","score_avg":"644.00","score_td":"0.00","score_max":"655.00","batch":"11","batch_diff":"126"},{"id":"12455","collegeid":"10001","provid":"19","syear":"2011","wl":"2","plan":"25","score_min":"633.00","score_avg":"651.00","score_td":"0.00","score_max":"690.00","batch":"11","batch_diff":"132"},{"id":"10762","collegeid":"10001","provid":"19","syear":"2010","wl":"2","plan":"25","score_min":"0.00","score_avg":"633.00","score_td":"0.00","score_max":"650.00","batch":"11","batch_diff":"121"},{"id":"8360","collegeid":"10001","provid":"19","syear":"2009","wl":"2","plan":"27","score_min":"623.00","score_avg":"637.00","score_td":"0.00","score_max":"670.00","batch":"11","batch_diff":"139"},{"id":"8359","collegeid":"10001","provid":"19","syear":"2009","wl":"2","plan":"3","score_min":"616.00","score_avg":"618.00","score_td":"0.00","score_max":"620.00","batch":"01","batch_diff":""},{"id":"5693","collegeid":"10001","provid":"19","syear":"2008","wl":"2","plan":"41","score_min":"699.00","score_avg":"703.00","score_td":"0.00","score_max":"737.00","batch":"11","batch_diff":"110"},{"id":"5692","collegeid":"10001","provid":"19","syear":"2008","wl":"2","plan":"2","score_min":"697.00","score_avg":"697.00","score_td":"0.00","score_max":"697.00","batch":"01","batch_diff":""},{"id":"5242","collegeid":"10001","provid":"19","syear":"2007","wl":"2","plan":"53","score_min":"553.00","score_avg":"659.00","score_td":"0.00","score_max":"689.00","batch":"11","batch_diff":"127"},{"id":"2841","collegeid":"10001","provid":"19","syear":"2007","wl":"2","plan":"3","score_min":"656.00","score_avg":"657.00","score_td":"0.00","score_max":"661.00","batch":"01","batch_diff":""},{"id":"5305","collegeid":"10001","provid":"19","syear":"2006","wl":"2","plan":"52","score_min":"656.00","score_avg":"674.00","score_td":"0.00","score_max":"701.00","batch":"11","batch_diff":"114"},{"id":"987","collegeid":"10001","provid":"19","syear":"2006","wl":"2","plan":"3","score_min":"670.00","score_avg":"670.00","score_td":"0.00","score_max":"671.00","batch":"01","batch_diff":""},{"id":"2","collegeid":"10001","provid":"19","syear":"2005","wl":"2","plan":"57","score_min":"614.00","score_avg":"698.00","score_td":"0.00","score_max":"731.00","batch":"11","batch_diff":"103"},{"id":"5274","collegeid":"10001","provid":"19","syear":"2005","wl":"2","plan":"12","score_min":"692.00","score_avg":"695.00","score_td":"0.00","score_max":"697.00","batch":"01","batch_diff":""},{"id":"4788","collegeid":"10001","provid":"19","syear":"2004","wl":"2","plan":"0","score_min":"665.00","score_avg":"0.00","score_td":"0.00","score_max":"0.00","batch":"00","batch_diff":""},{"id":"4384","collegeid":"10001","provid":"19","syear":"2003","wl":"2","plan":"0","score_min":"604.00","score_avg":"0.00","score_td":"0.00","score_max":"0.00","batch":"00","batch_diff":""},{"id":"4009","collegeid":"10001","provid":"19","syear":"2002","wl":"2","plan":"0","score_min":"664.00","score_avg":"0.00","score_td":"0.00","score_max":"0.00","batch":"00","batch_diff":""},{"id":"3562","collegeid":"10001","provid":"19","syear":"2001","wl":"2","plan":"0","score_min":"0.00","score_avg":"652.00","score_td":"0.00","score_max":"0.00","batch":"00","batch_diff":""}]
The meaning of each field is determined based on the actual table information. By viewing the original parsing JS Code, it is found that all the result fields are processed in Int mode. This is also true in development.

3. Save data

Through step 2, we have obtained all the data we want and the link and result format of the actual query. we store the data in the Android project.

1. Store the province information in values. xml. The province ID is the serial number of item + 1

<String-array name = "province"> <item> Beijing </item> <item> Tianjin </item> <item> Shanghai </item> <item> Chongqing </ item> <item> Hebei </item> <item> Henan </item> <item> Shandong </item> <item> Shanxi </item> <item> Anhui </ item> <item> Jiangxi </item> <item> Jiangsu </item> <item> Zhejiang </item> <item> Hubei </item> <item> Hunan </ item> <item> Guangdong </item> <item> Guangxi </item> <item> Yunnan </item> <item> Guizhou </item> <item> Sichuan </ item> <item> Shaanxi </item> <item> Qinghai </item> <item> Ningxia </item> <item> Heilongjiang </item> <item> Jilin </ item> <item> Liaoning </item> <item> Tibet </item> <item> Xinjiang </item> <item> Inner Mongolia </item> <item> Hainan </ item> <item> Fujian </item> <item> Gansu </item> <item> Hong Kong, Macao and Taiwan </item> </string-array>
2. Save the selection information of the arts and sciences department to values. xml. The selected value is item number + 1.

<String-array name = "type"> <item> liberal arts </item> <item> science </item> <item> comprehensive </item> </string-array>
3. The school file is saved as an ASCII code (other codes can be used, and the simple default encoding is used in this example) and stored in the assert/m/data.txt file.

Note:

During the analysis, we found that the drop-down box data of the selected school province and user location is only one piece different from that of Hong Kong, Macao, and Taiwan. In the example development, the differences are ignored and considered as a unified province list.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.