I have a problem with blocking buffer with the following code on my android application:
else if (tcpdumpButton.isChecked())
{
try
{
Process process1 = Runtime.getRuntime().exec("tcpdump");
BufferedReader osRes = new BufferedReader(new InputStreamReader(process1.getInputStream()));
StringBuffer output = new StringBuffer();
String line="";
while ((line = osRes.readLine()) != null)
{
output.append(line);
output.append("\n");
tv.setText(output);
setContentView(tv);
}
}
catch (Exception e)
{
throw e;
}
}
Since the tcpdump process is running continuously and never terminated i am unable to print the buffer contents on the screen.Can anybody tell me what i should do or give an example on how to read the buffer and print it on the screen without waiting for the process to terminate??