当我可以将其发送到servelet时,我的应用程序中就有一个类。
public class PinnedVehicle {
private String userId;
private Location location;
private Date timeToReturn;
private String notes;
private Bitmap photo;
}
现在,对于位置,我只真正需要经度和纬度,但是如何将其发送到服务器
目前我所要做的只是
String URL = "xxxx";
String result = "";
String deviceId = "xxxxx" ;
String q = "?lat="+location.getLatitude()+"&lng="+location.getLongitude()" //and so on for all strings and integers
HttpClient httpclient = new DefaultHttpClient();
HttpGet request = new HttpGet(URL+q);
request.addHeader("deviceId", deviceId);
ResponseHandler<String> handler = new BasicResponseHandler();
try {
result = httpclient.execute(request, handler);
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
httpclient.getConnectionManager().shutdown();
我将如何发送日期对象和位图对象?
最佳答案
您应该检查this thread。
关于java - 如何将对象从android手机发送到servlet?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6308722/