首页

android手机号码属地app源码

java

2020-6-21

可以输入手机号码查询归属地

package com.example.webserver;

import java.io.IOException;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import org.xmlpull.v1.XmlPullParserException;

import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.app.Activity;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends Activity {
	EditText editText;
	Button button;
	TextView textView;
	final static String SERVICE_NS = "http://WebXml.com.cn/";;
	final static String SERVICE_URL= "http://ws.webxml.com.cn/WebServices/MobileCodeWS.asmx";
	
	Handler handler=new Handler(){
		public void handleMessage(android.os.Message msg) {
			switch (msg.what) {
			case 0x123:
				textView.setText(msg.obj.toString());
				break;

			default:
				break;
			}
		}
	};
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        editText=(EditText)findViewById(R.id.editText);
        button=(Button)findViewById(R.id.button1);
        textView=(TextView)findViewById(R.id.textView1);
        button.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				final String methodName = "getMobileCodeInfo";
				final HttpTransportSE ht = new HttpTransportSE(SERVICE_URL);
				ht.debug=true;
				final SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
				SoapObject soapObject = new SoapObject(SERVICE_NS, methodName);
				soapObject.addProperty("mobileCode",editText.getText().toString().trim());
				envelope.bodyOut=soapObject;
				envelope.dotNet=true;
				new Thread(){
					public void run() {
						try {
							ht.call(SERVICE_NS methodName, envelope);
							Log.i("call",SERVICE_NS methodName);
							if (envelope.getResponse()!=null) {
								SoapObject result=(SoapObject)envelope.bodyIn;
								String detail1=result.getProperty(0).toString();
								Log.i("detail", detail1);
								Message msg=new Message();
								msg.what=0x123;
								msg.obj=detail1;
								handler.sendMessage(msg);
								
							}
						} catch (IOException e) {
							// TODO: handle exception
							e.printStackTrace();
						} catch (XmlPullParserException e) {
							// TODO 自动生成的 catch 块
							e.printStackTrace();
						}
					};
				}.start();
				
			}
		});
        
        
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    
}
资源下载此资源下载价格为3D币(VIP免费),请先
资源文件列表
WebServer/.classpath , 597
WebServer/.project , 845
WebServer/.settings/org.eclipse.jdt.core.prefs , 177
WebServer/AndroidManifest.xml , 950
WebServer/bin/AndroidManifest.xml , 950
WebServer/bin/WebServer.apk , 353648
WebServer/bin/classes/com/example/webserver/BuildConfig.class , 351
WebServer/bin/classes/com/example/webserver/MainActivity$1.class , 1023
WebServer/bin/classes/com/example/webserver/MainActivity$2$1.class , 2315
WebServer/bin/classes/com/example/webserver/MainActivity$2.class , 2303
WebServer/bin/classes/com/example/webserver/MainActivity.class , 1803
WebServer/bin/classes/com/example/webserver/R$attr.class , 349
WebServer/bin/classes/com/example/webserver/R$dimen.class , 470
WebServer/bin/classes/com/example/webserver/R$drawable.class , 416
WebServer/bin/classes/com/example/webserver/R$id.class , 563
WebServer/bin/classes/com/example/webserver/R$layout.class , 412
WebServer/bin/classes/com/example/webserver/R$menu.class , 397
WebServer/bin/classes/com/example/webserver/R$string.class , 481
WebServer/bin/classes/com/example/webserver/R$style.class , 440
WebServer/bin/classes/com/example/webserver/R.class , 703
WebServer/bin/classes.dex , 1102592
WebServer/bin/dexedLibs/android-support-v4-475a6f77386267c1a61271976fe440e9.jar , 232610
WebServer/bin/dexedLibs/ksoap2-android-assembly-3.1.0-jar-with-dependencies-2dfd708d208ccf6bd5834e4f9d6c7564.jar , 85051
WebServer/bin/jarlist.cache , 120
WebServer/bin/res/crunch/drawable-hdpi/ic_launcher.png , 5964
WebServer/bin/res/crunch/drawable-mdpi/ic_launcher.png , 3112
WebServer/bin/res/crunch/drawable-xhdpi/ic_launcher.png , 9355
WebServer/bin/res/crunch/drawable-xxhdpi/ic_launcher.png , 17889
WebServer/bin/resources.ap_ , 41237
WebServer/gen/com/example/webserver/BuildConfig.java , 163
WebServer/gen/com/example/webserver/R.java , 2767
WebServer/ic_launcher-web.png , 51394
WebServer/libs/android-support-v4.jar , 621451
WebServer/libs/ksoap2-android-assembly-3.1.0-jar-with-dependencies.jar , 157765
WebServer/proguard-project.txt , 781
WebServer/project.properties , 563
WebServer/res/drawable-hdpi/ic_launcher.png , 7658
WebServer/res/drawable-mdpi/ic_launcher.png , 3777
WebServer/res/drawable-xhdpi/ic_launcher.png , 12516
WebServer/res/drawable-xxhdpi/ic_launcher.png , 24777
WebServer/res/layout/activity_main.xml , 1295
WebServer/res/menu/main.xml , 263
WebServer/res/values/dimens.xml , 220
WebServer/res/values/strings.xml , 226
WebServer/res/values/styles.xml , 697
WebServer/res/values-sw600dp/dimens.xml , 203
WebServer/res/values-sw720dp-land/dimens.xml , 277
WebServer/res/values-v11/styles.xml , 334
WebServer/res/values-v14/styles.xml , 391
WebServer/src/com/example/webserver/MainActivity.java , 2981
没有账号? 忘记密码?

社交账号快速登录