I have an client server application on Android.And I have to send data from client to server. The data that I send is GPS data wrapped this way:
GeoPoint p = new GeoPoint(latitude,longitude);
geoPointsArray.add(p);
Now,everything goes fine...I succed to send the data through the socket,but at the server I have to take all this data and write it in a database.
The way that I read the data at the server is this:
BufferedReader in=new BufferedReader(new InputStreamReader(client.getInputStream()));
String line=null;
while((line = in.readLine()) != null)
{
}
Now in line = in.readLine()
, I have a line of GPS data (latitude,longitude) and I can't figure out how could I read (latitude,longitude) of a point, wrap it back in a geopoint p...after that read another (latitude,longitude) put开发者_JAVA技巧 it in "geopoint p" and so on....And after that to write "geopoint p" in a database!
P.S:What I don't understand is how to read from that "line" so that I put the correct latitude and longitude of a point together on the database.
Hope I've been clear enough.I'm here for further details.Thank u in advance!
Maybe you can send the Lat/Lon information on a Simple text manner and in the server side do a very simple parsing. This would be quick and easy to do. So, instead of sending an direct GeoPoint object send the info inside of it written plainly and read it the other side of the pipe. Sounds good?
JQCorreia
精彩评论