at dalvik.system.NativeStart.run(Native Method)异常

holmesyang 发布于 2014/12/12 11:59
阅读 2K+
收藏 0

华为云11月刊推送:DIY微信问答机器人,高性能计算代码的20个技巧!>>>

passs值传不到,dialog弹出输入密码,点击连接后直接强制退出了。


decivelist.setOnItemClickListener(new OnItemClickListener() {



@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int position, long arg3) {

if ( (list.get(position).get("capabilities")).toString().contains("WEP")){
AlertDialog.Builder builder = new AlertDialog.Builder(
MainActivity.this);
LayoutInflater inflater = getLayoutInflater();
View view = inflater.inflate(R.layout.wifi_config_dialog, null);
password = (EditText) view.findViewById(R.id.password);
builder.setTitle("请输入密码");
builder.setView(view);
builder.setPositiveButton("连接",
new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface arg0, int arg1) {
// TODO Auto-generated method stub
// passs = password.getText().toString().trim();
try{
passs = password.getText().toString().trim();
} catch(NumberFormatException e){
 
   //TODO
   //添加异常处理
}
System.out.println("psss"+passs);

wifiAdmin.addNetwork(wifiAdmin
.CreateWifiInfo(list.get(ssidint).get("wifissid")
.toString(),passs, 2));
if (wifiAdmin.checkState() == WifiManager.WIFI_STATE_ENABLED)
{
Toast.makeText(
getApplicationContext(),
"正在连接到"
+ list.get(ssidint).get("wifissid")
.toString(), Toast.LENGTH_LONG)
.show();
} else {
Toast.makeText(getApplicationContext(), "连接失败",
Toast.LENGTH_SHORT).show();
}
}
});

builder.setNegativeButton("取消",
new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface arg0, int arg1) {
// TODO Auto-generated method stub
}
});

AlertDialog dialog = builder.create();
dialog.show();

}
加载中
返回顶部
顶部