基于Android系统的手机天气预报软件本科毕业论�- 百度文库

2026/4/27 3:55:13

android.R.layout.simple_list_item_1, cityList));

}

public List getAllCitiesNames(){

final List cityList = new LinkedList(); Map map = new HashMap(); map.put(\

try {

String

xmlStr

WebServiceCaller.doCallWebService(Constant.SOAP_ACTION, Constant.METHOD_NAME, map);

RootElement root = new RootElement(\ Element entry = root.getChild(\

entry.getChild(\ new EndTextElementListener() { public void end(String body) {

System.out.println(\ cityList.add(body); } });

create the factory

SAXParserFactory factory = SAXParserFactory.newInstance(); create a parser

SAXParser parser = factory.newSAXParser();

XMLReader xmlreader = parser.getXMLReader();

=

xmlreader.setContentHandler(root.getContentHandler());

get our data via the xml string

InputSource is = new InputSource(new StringBufferInputStream(xmlStr));

xmlreader.parse(is);

((TextView)findViewById(R.id.testText)).setText(result.toString()); } catch(Exception e) { e.printStackTrace();

((TextView)findViewById(R.id.testText)).setText(\

e.getClass().getName() + \ ((TextView)findViewById(R.id.lblStatus)).setText(E.getMessage());

return null;

}

return cityList; } @Override

protected void onListItemClick(ListView l, View v, int position, long id) {

cityName = (String) l.getItemAtPosition(position);

callWeatherResultActivity(cityName);

super.onListItemClick(l, v, position, id);

}

+

private void callWeatherResultActivity(String cityName){

Log.d(\

Intent i = new Intent(getApplicationContext(), WeatherResult.class); i.putExtra(\ i.putExtra(\ i.putExtra(\

}

startActivity(i);

}

5.3.2 ÌìÆø½á¹û½çÃæ£¨Ïêϸ½çÃæ£©

package com.xmobileapp.android.weatherforecast;

import java.io.StringBufferInputStream; import java.util.HashMap; import java.util.Map;

import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.InputSource; import org.xml.sax.XMLReader;

import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.sax.Element;

import android.sax.EndTextElementListener; import android.sax.RootElement; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.widget.TextView;

import com.xmobileapp.android.weatherforecast.meta.CityWeather; import com.xmobileapp.android.weatherforecast.meta.Constant;

import com.xmobileapp.android.weatherforecast.transport.WebServiceCaller;

public class WeatherResult extends Activity {

private CityWeather cityWeather;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState); setContentView(R.layout.result);

TextView tv = (TextView) this.findViewById(R.id.resultText);

cityWeather = new CityWeather(); final StringBuffer sb = new StringBuffer();

Intent queryIntent = getIntent();

String cityName = queryIntent.getStringExtra(\String countryName = queryIntent.getStringExtra(\

Map map = new HashMap();


基于Android系统的手机天气预报软件本科毕业论æ–?- 百度æ–.doc ½«±¾ÎĵÄWordÎĵµÏÂÔØµ½µçÄÔ
ËÑË÷¸ü¶à¹ØÓÚ£º 基于Androidç³»ç»Ÿçš„æ‰‹æœºå¤©æ°”é¢„æŠ¥è½¯ä»¶æœ¬ç§‘æ µÄÎĵµ
Ïà¹ØÍÆ¼ö
Ïà¹ØÔĶÁ
¡Á ÓοͿì½ÝÏÂÔØÍ¨µÀ£¨ÏÂÔØºó¿ÉÒÔ×ÔÓɸ´ÖƺÍÅŰ棩

ÏÂÔØ±¾ÎĵµÐèÒªÖ§¸¶ 10 Ôª

Ö§¸¶·½Ê½£º

¿ªÍ¨VIP°üÔ»áÔ± ÌØ¼Û£º29Ôª/ÔÂ

×¢£ºÏÂÔØÎĵµÓпÉÄÜ¡°Ö»ÓÐĿ¼»òÕßÄÚÈݲ»È«¡±µÈÇé¿ö£¬ÇëÏÂÔØÖ®Ç°×¢Òâ±æ±ð£¬Èç¹ûÄúÒѸ¶·ÑÇÒÎÞ·¨ÏÂÔØ»òÄÚÈÝÓÐÎÊÌ⣬ÇëÁªÏµÎÒÃÇЭÖúÄã´¦Àí¡£
΢ÐÅ£ºxuecool-com QQ£º370150219