String lience=chepai_short.getText().toString()+chepai_number.getText().toString(); openmap.put("lience",lience.toString()); openmap.put("UserName", tv_username.getText().toString()); openmap.put("cardtype",tv_cardtype.getText().toString()); openmap.put("InOutName", tv_inrk.getText().toString()); openmap.put("InOperatorCard",SwitchActivity.username.toString()); //SwitchActivity.username // jsonpost_mode mode=new jsonpost_mode(); // mode.Lience(lience); // mode.UserName(tv_username.getText().toString()); // mode.Cardtype(); String resultData=""; String content=""; if(openmap.size()!=0){ GsonBuilder gsonBuilder = new GsonBuilder(); // gsonBuilder.registerTypeAdapter(Exception.class, new ExceptionSerializer()); Gson gson = gsonBuilder.create(); content="Josnstr="+ URLEncoder.encode(gson.toJson(openmap),"utf-8"); } resultData=HttpPostTools.getPostReslut("Home/GateInSet", content);
记得在object类型中要确定好类型。特别是getext()请记得tostring()...
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-10-26 03:12:36