case R.id.business_address://营业地址 Intent intentAddress=new Intent(BasicLimit.this,AddressActivity.class); if(businessAddress.getText().toString().trim().toString().equals("")){ intentAddress.putExtra("text",""); startActivityForResult(intentAddress, 0x113); return; }else{ if(businessAddress.getText().toString().trim().toString().equals("请选择")){ intentAddress.putExtra("text",""); startActivityForResult(intentAddress, 0x113); return; }else{ intentAddress.putExtra("text",businessAddress.getText().toString()); startActivityForResult(intentAddress, 0x113); } } break;
mListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Map<String,Object> listData=(Map<String, Object>) mListView.getAdapter().getItem(position); Intent intent=new Intent(); intent.putExtra("intent", new Gson().toJson(listData)); AddressActivity.this.setResult(0x113, intent); AddressActivity.this.finish(); } });
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (data == null) { return; } if(resultCode==103){ cindustryPId.setData(new Gson().fromJson(data.getStringExtra("parent"), Map.class), new Gson().fromJson(data.getStringExtra("sub"),Map.class)); }else if(resultCode==0x113){//获取位置 经纬度 String intent = data.getStringExtra("intent"); Map<String,Object> result = new Gson().fromJson(intent,Map.class); MyApplication.getGlobalVar().putString("addressName", result.get("name").toString()); MyApplication.getGlobalVar().putString("lngAndlat", result.get("lngAndlat").toString()); businessAddress.setText(MyApplication.getGlobalVar().getString("addressName")); } }