我正在尝试通过 http 请求发送 GPS 数据。
问题是 GPS 数据是 double 格式和 nameValuePair.add(new BasicNameValuePair(String, String)
不允许双重值。
如何发送 double 值或将 double 值转换为字符串?
谢谢,
httpclient client = new defaulthttpclient();
httppost post = new httppost("web address");
post.setEntity(new UrlencodedFormEntity(nameValuePairs));
httpresponse response = client.execute(post);
请您参考如下方法:
您可能需要使用两个 nameValuePairs 分别发送纬度和经度:
double latitude = currentLocation.getLatitude();
double longitude = currentLocation.getLongitude();
nameValuePairs.add(new BasicNameValuePair("latitude",Double.toString(latitude)));
nameValuePairs.add(new BasicNameValuePair("longitude",Double.toString(longitude)));




