Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Try flushing the outputstream and Closing the outputstream. This should flush the remaining data in the buffer to the Android device. Also you need to add a new line escape character to every output (if there is not present one within the values of the ArrayList) i.e. on your PC code do something like this:</p> <pre><code> PC Code: list = FilterFile.aList; for(int z = 0; z &lt; list.size(); z++) { int a = list.size(); System.out.println("in for\n"+list.size()); String str = list.get(z); System.out.println(str); out.write((str+"\n").getBytes()); out.flush(); } out.close(); Android (Client) side code: public class ConnectedThread extends Thread { private BluetoothSocket mmSocket; private InputStream mmInStream = null; public OutputStream mmOutStream = null; private static final String TAG = "ConnectedThread"; private static final boolean D = true; int i; char a; String line; String y = ""; //DataInputStream din=null; public ConnectedThread(BluetoothSocket socket) { mmSocket = socket; InputStream tmpIn = null; OutputStream tmpOut = null; try { tmpIn = socket.getInputStream(); tmpOut = socket.getOutputStream(); } catch (IOException e) { } mmInStream = tmpIn; mmOutStream = tmpOut; //din = new DataInputStream(mmInStream); if (D) Log.e(TAG, "-- in connected() --"); } public void run() { if (D) Log.e(TAG, "-- ConnectedThread --"); } public void write(byte[] bytes) { try { mmOutStream.write(bytes); } catch (IOException e) { } } public String readList() { String data = ""; try { byte buff[] = new byte[1024]; int count = -1; while((count = mmInStream.read(buff, 0, 1024)) != -1){ data += new String(buff,0,count); } String lines[] = data.split("\n"); for(int i = 0; i &lt; lines.length; i++){ //this will print your individual lines... System.out.println(lines[i]); } } catch (Exception e) { ///print your error message here } finally{ if(in != null){ try { mmInStream.close(); } catch (Exception e) { e.printStackTrace(); } } } return data; } public void cancel() { try { mmSocket.close(); } catch (IOException e) { } } </code></pre> <p>}</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload