[英]how to use below response received from server and save in to database
我将联系人发送到服务器以检查其是否在服务器上注册,服务器返回此响应如何使用它并保存到数据库编号中,并根据编号结果正确与否7837580550,false,9780929022,true,9855772008,false,
Use a List of Map to the store the values and insert into database using it. 使用地图列表存储值,并使用它插入数据库。
String[] arr=response.split(",");
List<Map<String,String>> list = new ArrayList();
for(int i = 0; i<arr.length; i+2){
String contactNo = arr[i];
String result = arr[i+1];
Map<String,String> m = new HashMap();
m.put(contactNo,result);
list.add(m);
}
As per my thinking you should get response in XMl format. 按照我的想法,您应该以XMl格式获得答复。 I will be easy to handle and easy to manage the parsed output. 我将很容易处理和管理已解析的输出。
<Response>
<MobileNo>7837580550</MobileNo>
<Status>False</Status>
<MobileNo>9780929022</MobileNo>
<Status>True</Status>
<MobileNo>9855772008</MobileNo>
<Status>False</Status>
</Response>
While parsing you can store parsed information in different array. 解析时,您可以将解析的信息存储在不同的数组中。 Rest you know how to get data from array and store in db. 剩下的你知道如何从数组中获取数据并将其存储在db中。
Hope this will help. 希望这会有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.