MainActivity
package com.example.weather;
import java.net.MalformedURLException;
import java.net.URL;
import org.ksoap2.serialization.SoapObject;
import weatherforecast.soap.SoapUtil;
import weatherforecast.tools.ImageTool;
import android.os.Bundle;
import android.app.Activity;
import android.text.Editable;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends Activity {
private EditText city;
private ImageView weatherIcon;
private TextView weatherToday;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
city=(EditText) this.findViewById(R.id.editText1);
weatherIcon=(ImageView) this.findViewById(R.id.imageView1);
weatherToday=(TextView) this.findViewById(R.id.textView2);
}
public void getWeather(View view){
Toast.makeText(this, "欢迎使用天气预报系统", 5).show();
String theCityName=city.getText().toString();
String wsdlUrl="http://www.webxml.com.cn/webservices/weatherwebservice.asmx";
String webMethod="getWeatherbyCityName";
SoapObject result=(SoapObject) SoapUtil.doTra
通过调用webservice实现查询天气预报系统
最新推荐文章于 2022-06-14 10:21:27 发布