手机号码归属地离线查询
select location from data2 where id = (select outkey from data1 where id = '1384444'); |
1、NumberQueryActivity.java package cn.zengfansheng.mobilesafe;
import java.io.IOException;
import android.app.Activity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import cn.zengfansheng.mobilesafe.dao.AddressDao;
import cn.zengfansheng.mobilesafe.utils.ToastUtils;
/**
* 12、手机号码归属地查询Activity界面
* @author hacket
*/
public class NumberQueryActivity extends Activity {
private EditText et_phone_number;
private EditText et_query_address;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_number_query);
et_phone_number = (EditText) this.findViewById(R.id.et_phone_number);
et_query_address = (EditText) this.findViewById(R.id.et_query_address);
}
/**
* 1、查询号码归属地
* @param view
*/
public void queryAddressByPhoneNum(View view){
String phoneNum = et_phone_number.getText().toString().trim();// 待手机号码
if (TextUtils.isEmpty(phoneNum)) {// 1、输入为null
ToastUtils.showToastInThread(this, "号码不能为空!");
et_query_address.setText("");
return;
}
try {
String address = AddressDao.getAddress(this, phoneNum);
et_query_address.setText(address);
} catch (IOException e) {
e.printStackTrace();
ToastUtils.showToastInThread(this, "查询手机号码地址失败!");
}
}
} |
2、
AddressDao.java
|