2011-06-10 53 views
1

我有一个类,在我的应用程序时,我可以发送到servelet instatianted。如何从android手机发送对象到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(); 

会如何我去发送日期对象和位图对象?

回答

相关问题