没有合适的资源?快使用搜索试试~ 我知道了~
android webserviceandroid webserviceandroid
需积分: 1 0 下载量 82 浏览量
2011-06-25
15:38:02
上传
评论
收藏 12KB TXT 举报
温馨提示
试读
4页
android webserviceandroid webserviceandroid webservice
资源推荐
资源详情
资源评论
package com.android;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.AndroidHttpTransport;
import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; import android.text.method.LinkMovementMethod; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView;
public class MainActivity extends Activity { private static String LOG_TAG = "Weather"; private static boolean DEBUG = false; private static final int SHOW_ABOUT = 0x0001; private static final String NAMESPACE = "http://WebXml.com.cn/"; //WebService地址 private static String URL = "http://www.webxml.com.cn/webservices/weatherwebservice.asmx"; private static final String METHOD_NAME = "getWeatherbyCityName"; private static String SOAP_ACTION = "http://WebXml.com.cn/getWeatherbyCityName";
private String weatherToday; private String weatherTomorrow; private String weatherAfterday; private String weatherCurrent; private int iconToday[] = new int[2]; private int iconTomorrow[] = new int[2]; private int iconAfterday[] = new int[2];
private Button okButton; private EditText textInput; private ImageView imageView1; private ImageView imageView2; private TextView textWeatherToday; private ImageView imageView3; private ImageView imageView4; private TextView textWeatherTomorrow; private ImageView imageView5; private ImageView imageView6; private TextView textWeatherAfterday; private TextView textWeatherCurrent; private SoapObject detail; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);
okButton = (Button) findViewById(R.id.WeatherSearch);
textInput = (EditText) findViewById(R.id.TextWeather);
imageView1 = (ImageView) findViewById(R.id.ImageView01);
imageView2 = (ImageView) findViewById(R.id.ImageView02);
textWeatherToday = (TextView) findViewById(R.id.WeatherToday);
imageView3 = (ImageView) findViewById(R.id.ImageView03);
imageView4 = (ImageView) findViewById(R.id.ImageView04);
textWeatherTomorrow = (TextView) findViewById(R.id.WeatherTomorrow);
imageView5 = (ImageView) findViewById(R.id.ImageView05);
imageView6 = (ImageView) findViewById(R.id.ImageView06);
textWeatherAfterday = (TextView) findViewById(R.id.WeatherAfterday);
textWeatherCurrent = (TextView) findViewById(R.id.WeatherCurrent);
okButton.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { showWeather();
}
});
}
private void showWeather() { String city = textInput.getText().toString();
if (city.length() == 0) city = "合肥"; getWeather(city);
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.AndroidHttpTransport;
import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; import android.text.method.LinkMovementMethod; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView;
public class MainActivity extends Activity { private static String LOG_TAG = "Weather"; private static boolean DEBUG = false; private static final int SHOW_ABOUT = 0x0001; private static final String NAMESPACE = "http://WebXml.com.cn/"; //WebService地址 private static String URL = "http://www.webxml.com.cn/webservices/weatherwebservice.asmx"; private static final String METHOD_NAME = "getWeatherbyCityName"; private static String SOAP_ACTION = "http://WebXml.com.cn/getWeatherbyCityName";
private String weatherToday; private String weatherTomorrow; private String weatherAfterday; private String weatherCurrent; private int iconToday[] = new int[2]; private int iconTomorrow[] = new int[2]; private int iconAfterday[] = new int[2];
private Button okButton; private EditText textInput; private ImageView imageView1; private ImageView imageView2; private TextView textWeatherToday; private ImageView imageView3; private ImageView imageView4; private TextView textWeatherTomorrow; private ImageView imageView5; private ImageView imageView6; private TextView textWeatherAfterday; private TextView textWeatherCurrent; private SoapObject detail; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);
okButton = (Button) findViewById(R.id.WeatherSearch);
textInput = (EditText) findViewById(R.id.TextWeather);
imageView1 = (ImageView) findViewById(R.id.ImageView01);
imageView2 = (ImageView) findViewById(R.id.ImageView02);
textWeatherToday = (TextView) findViewById(R.id.WeatherToday);
imageView3 = (ImageView) findViewById(R.id.ImageView03);
imageView4 = (ImageView) findViewById(R.id.ImageView04);
textWeatherTomorrow = (TextView) findViewById(R.id.WeatherTomorrow);
imageView5 = (ImageView) findViewById(R.id.ImageView05);
imageView6 = (ImageView) findViewById(R.id.ImageView06);
textWeatherAfterday = (TextView) findViewById(R.id.WeatherAfterday);
textWeatherCurrent = (TextView) findViewById(R.id.WeatherCurrent);
okButton.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { showWeather();
}
});
}
private void showWeather() { String city = textInput.getText().toString();
if (city.length() == 0) city = "合肥"; getWeather(city);
资源评论
耗子jerry
- 粉丝: 4
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功