1

httpリクエストでGPSデータを送信しようとしています。

問題は、GPSデータが二重形式であり、nameValuePair.add(new BasicNameValuePair(String, String)

double値は許可されません。

double値を送信したり、doubleを文字列に変換したりするにはどうすればよいですか?

ありがとう、

httpclient client = new defaulthttpclient();
httppost post = new httppost("web address");
post.setEntity(new UrlencodedFormEntity(nameValuePairs));
httpresponse response = client.execute(post);
4

1 に答える 1

1

緯度と経度を別々に送信するには、2つの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)));
于 2012-04-22T03:38:53.070 に答える