Using Appinventor to read the weather interface (full version)

Source: Internet
Author: User
Tags appinventor

Step1: interface design


, there are three horizontal layouts in the interface, the first horizontal layout of city is the text input box, the message is: Please enter pinyin (prompted to enter pinyin, is the requirements of the Baidu interface provisions), query and clear are buttons, the second layout has two labels, headinfo is used to display the information, info is used to display the basic information returned, and the third layout contains two labels, headweather is used to display the prompt information, Weather is used to display weather forecast information. A non-visual component adds a Web client to access the Weather forecast API interface.


STEP2: Logical Design

1. Initialize Global variables



The globallist is used to store JSON data returned from the interface, and NewList is used to store the processed data.

2, defining procedure to parse JSON data (flatten multilevel list to level two list)


     


4, processing data returned by Web page


     infollist and weatherlist are local variables that are used to access city information data and weather forecast data, Globallist is used to store the JSON data returned by the client, and next calls the process of parsing the JSON data, passing globallist as a parameter. After calling this process, the flattened level two list has already been stored in the variable newlist, so we can easily find the city information in the newlist with the keyword "basic" and find the real-time weather information through the keyword "Now".


     finally took the city name, country name and weather conditions in infolist and weatherlist by the corresponding keywords. (Because the weather forecast data is more complex, not all of them read, the clouds can choose the information they need to display it according to the actual situation)

5,   Set" empty "button code


    When you click the button" empty ", the current list and display information is emptied to avoid the impact of the last access data retention on this visit.


/span>

STEP3: Testing



A porter who does not do internet in the cloud

Insist on sharing practical information and original information technology tutorials


Using Appinventor to read the weather interface (full version)

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.