There is a weather forecast demand in the project. I found a suggestion on the Internet for most people to use WebService to obtain data. So I tried to do it. I did not know it, but I learned a lot from it.
First, let's get the weather service provided by the National Meteorological Administration through WebService.
The android SDK does not provide a library to
BackgroundWe need simple access to XML to parse XML documents. So you just have to know where the results are in the XML document code and then parse it. For example, in the following picture, we want to know about the weather in Sfax, Tunisia:
In the beginning, we need to specify the city or state where we want to know the weather.
The code is as follows
Copy Code
String C
Android gets weather information via Google API
Copy Code code as follows:
public class Weatheractivity extends activity {
Private TextView txcity;
Private Button btnsearch;
Private Handler Weatherhandler;
Private Dialog ProgressDialog;
private timer timer;
/** called the activity is a. */
@Override
public void OnCreate (Bundle savedinstances
Learning Android For some time, should improve their actual combat ability, do some simple demo. Below we introduce how to use the network API to realize the weather forecast function, mainly involves how to use the API to obtain the network data, the network data return is generally the JSON format, here also involves
Advantage: Data and style separationDisadvantage: not complete. City retrieval is not supported.
Google Code: http://code.google.com/p/weather-china/
Weather-China encapsulates weather RSS feed provided by Yahoo and provides a rest API interface in JSON format. To obtain weather
[API] Sina weather interface Beta, api Sina weather beta
Sina's daily interface was well recognized by the public, but it was very ugly after Baidu, so he built a tool class. Here, he helped to write down the daily interface, see where to change.
Jar name: NonentityUtil
Class Name: SinaWeatherUtil, such as Sina Tianq
Yahoo weather API usage notes, Yahoo weather apiBase_url:Https://query.yahooapis.com/v1/public/yql? Q =, public query interface, limited query timesHttps://query.yahooapis.com/v1/yql? Q =: Get the ApkId after registration. There is a limit on the number of queries, but it is enough. 0.1 million times/dayStep 1: locate the user's location on the mobile phone end (
Use Google weather API to query weather forecasts
Google weather API only supports querying by zip code in the United States. For example:Http://www.google.com/ig/api? Hl = ZH-CN weather
Weather. php Page code
/*** Notice of license** This source file is part of evebit's private project.** Do not use this file in other place.** @ Category evebit_library* @ Package Application* @ Author Chen Qiao * @ Version $ ID: event. php 130 2011-03-18 03: 10: 02z Cheng. Wei $* @ Copyright (c) 2011 evebit Inc. China (http://www.evebit.com)*/
/*** Weather class** Access to Google
Recently, the project has been very busy, and many of the company's chores have come to me, so I can't concentrate on the project, simply, today I took the time to play with Google's weather forecast service. Believe in this articleArticleTo let you know how to initiate an HTTP access request (webrequest) under. Net CF and process the requested data, such as XML data and image data. Of course, it's also entertaining to share it here!
Start, we need
Weather forecast has been a basic function of the major sites, the recent small series also want to make one on the site, a little bit, in the network search for a long time, finally found the open source free weather API and all regional code (National Weather Bureau), as follows:Weather interface provided by the Nati
There is nothing to do to get the weather API, roughly checked, the domestic relatively good or Chinese weather Network (China Meteorological station), the portal has Sina and Tencent (search), other some small sites worry about instability, so no use.
The simplest script. Send a request to get JSON and parse it and simply output it to the screen.
This is only
This site part of the article translated from English documents, but limited to my English proficiency limited, there is no way to understand the statement, the end of the article is generally given the source of the translation, good English parents can refer to the original version of English. Another part of the site is gradually improving the function ...
Please look forward to! If there is a problem, you can go to the message feedback!
Weather fo
This site part of the article translated from English documents, but limited to my English proficiency limited, there is no way to understand the statement, the end of the article is generally given the source of the translation, good English parents can refer to the original version of English. Another part of the site is gradually improving the function ...Please look forward to! If there is a problem, you can go to the message feedback!Weather fore
provinces, where the Pyname field is the file name of each province's XML, such as the Beijing in Beijing, That means Beijing's XML address is the weather in Http://flash.weather.com.cn/wmaps/xml/beijing.xml province, which lists data for each city in the province, and Beijing lists the districts. TMP1 is the lowest temperature low, TMP2 is the highest temperature, the URL is very important, we'll talk about it later. State1 and State2 are gods horse
Wind Weather website: https://www.heweather.com/After registration there will be a personal authentication key in the consoleAPI Help Documentation: HTTPS://WWW.HEWEATHER.COM/DOCUMENTS/API/V5#!/usr/bin/python#-*-coding:utf-8-*-#调用和风天气API查询当前天气信息 #2017/07/12import jsonimport urllib2import oscity= ' Beijing ' # keykey= ' your key ' city_name={' Beijing ': ' Beijing
This article describes the Java call to the China Weather Network API to obtain weather information. Share to everyone for your reference. The implementation method is as follows:
An example of Harbin Ice Country weather API call w
Together to develop Android weather software (I), android weather
Starting from today, I plan to introduce how to develop an Android weather software, which involves many basic knowledge points, it is suitable for beginners or th
Android Program-National Weather Forecast query (aggregated data development), android Weather Forecast
I. project demonstration effect:
Project source code:Http://yunpan.cn/cZVWIieuFyK9I access password 2eac
Ii. Use the aggregate data SDK: (1) aggregated data official website address: http://www.juhe.cn/
(2) regist
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.