I created a Java server application and am trying to connect with my Android community. After reading the connection with the Android client server , I tried the socket example. However, I ran into a wall because on the server side I can return an array of my object, but on the client side I cannot restore it, since the buffer only accepts the line Server code
public List<Person> processInput(String theInput) { String peopleOutput = null; List<Person> people = new ArrayList<Person>(); if (state == WAITING) { SqliteDBhelper db = new SqliteDBhelper(); people = db.getPeople(); return people;
Client code
BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in)); List<Person> fromServer; String fromUser; while ((fromServer = in.readLine()) != null) { List<Person> people = new ArrayList<Person>(); Person person = new Person(); people = fromServer;
So from the look, I cannot pass an object through this socket method. Will json do what i need? I just don't want to spend another day on something that won't work for me. All I am trying to do is have a db that my server has access to, the server reads db and returns the table data as my objects.
source share