如何使用谷—歌天气 API 制作自己的安卓天气应用程序
- 资源大小:2.13 MB
- 上传时间:2021-06-29
- 下载次数:0次
- 浏览次数:2次
- 资源积分:1积分
-
标 签:
Java
java
资 源 简 介
翻译 maninwest@Codeforge 作者:Hadrich Mohamed@CodeProject如果想制作简单的 Android 天气应用程序,你可以使用谷—歌的天气 API 的 XML 解析。你只需要了解 XML 解析流程就够了。使用代码开始时,指定天气的城市或州。String c = city.getText().toString();
String s = state.getText().toString();
StringBuilder URL = new StringBuilder(BaseURL);
URL.append(c+","+s);
String fullUrl= URL.toString();
try
{
URL website= new URL(fullUrl);
//getting xmlReader to parse data
SAXParserFactory spf= SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader() ;
HandlingXmlStuff doingWork = new HandlingXmlStuff();
xr.setContentHandler(doingWork);
xr.parse(new InputSource(website.openStream()));
String information = doingWork.getInformation();
文 件 列 表
WeatherApplication\.classpath
WeatherApplication\.project
WeatherApplication\AndroidManifest.xml
WeatherApplication\ic_launcher-web.png
WeatherApplication\proguard-project.txt
WeatherApplication\project.properties
WeatherApplication\bin\AndroidManifest.xml
WeatherApplication\bin\classes.dex
WeatherApplication\bin\jarlist.cache
WeatherApplication\bin\R.txt
WeatherApplication\bin\resources.ap_
WeatherApplication\bin\WeatherApplication.apk
WeatherApplication\bin\classes\android\support\v7\appcompat\R$anim.class
WeatherApplication\bin\classes\android\support\v7\appcompat\R$attr.class
WeatherApplication\bin\classes\android\support\v7\appcompat\R$bool.class
WeatherApplication\bin\classes\android\support\v7\appcompat\R$color.class
WeatherApplication\bin\classes\android\support\v7\appcompat\R$dimen.class
WeatherApplication\bin\classes\android\support\v7\appcompat\R$drawable.class
WeatherApplication\bin\classes\android\support\v7\appcompat\R$id.class
WeatherApplication\bin\classes\android\support\v7\appcompat\R$integer.class
WeatherApplication\bin\classes\android\support\v7\appcompat\R$layout.class
WeatherApplication\bin\classes\android\support\v7\appcompat\R$string.class
WeatherApplication\bin\classes\android\support\v7\appcompat\R$style.class
WeatherApplication\bin\classes\android\support\v7\appcompat\R$styleable.class
WeatherApplication\bin\classes\android\support\v7\appcompat\R.class
WeatherApplication\bin\classes\com\example\weatherapplication\BuildConfig.class
WeatherApplication\bin\classes\com\example\weatherapplication\HandlingXmlStuff.class
WeatherApplication\bin\classes\com\example\weatherapplication\Main.class
WeatherApplication\bin\classes\com\example\weatherapplication\R$anim.class
WeatherApplication\bin\classes\com\example\weatherapplication\R$attr.class
WeatherApplication\bin\classes\com\example\weatherapplication\R$bool.class
WeatherApplication\bin\classes\com\example\weatherapplication\R$color.class
WeatherApplication\bin\classes\com\example\weatherapplication\R$dimen.class
WeatherApplication\bin\classes\com\example\weatherapplication\R$drawable.class
WeatherApplication\bin\classes\com\example\weatherapplication\R$id.class
WeatherApplication\bin\classes\com\example\weatherapplication\R$integer.class
WeatherApplication\bin\classes\com\example\weatherapplication\R$layout.class
WeatherApplication\bin\classes\com\example\weatherapplication\R$menu.class
WeatherApplication\bin\classes\com\example\weatherapplication\R$string.class
WeatherApplication\bin\classes\com\example\weatherapplication\R$style.class
WeatherApplication\bin\classes\com\example\weatherapplication\R$styleable.class
WeatherApplication\bin\classes\com\example\weatherapplication\R.class
WeatherApplication\bin\classes\com\example\weatherapplication\XMLDataCollected.class
WeatherApplication\bin\dexedLibs\android-support-v4-286f45ff16d5bd9733de3c3e561c7857.jar
WeatherApplication\bin\dexedLibs\android-support-v7-appcompat-cba7dacb9fd30282b987db8eead28f5a.jar
WeatherApplication\bin\dexedLibs\appcompat_v7_5-494ab4798c8c51da9b3fcff7e2e35eed.jar
WeatherApplication\bin\res\crunch\drawable-hdpi\ic_launcher.png
WeatherApplication\bin\res\crunch\drawable-mdpi\ic_launcher.png
WeatherApplication\bin\res\crunch\drawable-xhdpi\ic_launcher.png
WeatherApplication\bin\res\crunch\drawable-xxhdpi\ic_launcher.png
WeatherApplication\gen\android\support\v7\appcompat\R.java
WeatherApplication\gen\com\example\weatherapplication\BuildConfig.java
WeatherApplication\gen\com\example\weatherapplication\R.java
WeatherApplication\libs\android-support-v4.jar
WeatherApplication\res\drawable-hdpi\ic_launcher.png
WeatherApplication\res\drawable-mdpi\ic_launcher.png
WeatherApplication\res\drawable-xhdpi\ic_launcher.png
WeatherApplication\res\drawable-xxhdpi\ic_launcher.png
WeatherApplication\res\layout\fragment_main.xml
WeatherApplication\res\layout\weather.xml
WeatherApplication\res\menu\main.xml
WeatherApplication\res\values\dimens.xml
WeatherApplication\res\values\strings.xml
WeatherApplication\res\values\styles.xml
WeatherApplication\res\values-v11\styles.xml
WeatherApplication\res\values-v14\styles.xml
WeatherApplication\res\values-w820dp\dimens.xml
WeatherApplication\src\com\example\weatherapplication\HandlingXmlStuff.java
WeatherApplication\src\com\example\weatherapplication\Main.java
WeatherApplication\src\com\example\weatherapplication\XMLDataCollected.java